-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* moved jackson-next to this repo * fixed working-directory * updated package-lock * fixed docker build * fixed dockerfile * cleanup * save npm version for use in the build step * switching the order * fixed env secret * update saml-jackson to the current version before building the next.js service * build from typescript and change main and types before publishing npm * copy README.md from root before publishing npm * update README only for prod versions * read version from root package.json file * fixed artifact * updated package-lock
- Loading branch information
1 parent
40706fd
commit 3754f2b
Showing
77 changed files
with
31,078 additions
and
11,528 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
node_modules | ||
npm-debug.log | ||
.git | ||
.github | ||
_dev | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,39 @@ | ||
.vscode | ||
node_modules/** | ||
.nyc_output | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
_config | ||
dist | ||
.DS_Store | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# local env files | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
# typescript | ||
*.tsbuildinfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
node_modules | ||
.next | ||
public | ||
**/**/node_modules | ||
**/**/.next | ||
**/**/public | ||
|
||
*.lock | ||
*.log | ||
|
||
.gitignore | ||
.npmignore | ||
.prettierignore | ||
.DS_Store | ||
.eslintignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = { | ||
bracketSpacing: true, | ||
bracketSameLine: true, | ||
singleQuote: true, | ||
jsxSingleQuote: true, | ||
trailingComma: "es5", | ||
semi: true, | ||
printWidth: 110, | ||
arrowParens: "always", | ||
importOrderSeparation: true, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"editor.formatOnSave": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { DatabaseEngine, DatabaseType } from '@boxyhq/saml-jackson'; | ||
|
||
const hostUrl = process.env.HOST_URL || 'localhost'; | ||
const hostPort = Number(process.env.PORT || '5000'); | ||
const externalUrl = process.env.EXTERNAL_URL || 'http://' + hostUrl + ':' + hostPort; | ||
const samlPath = '/api/oauth/saml'; | ||
|
||
const apiKeys = (process.env.JACKSON_API_KEYS || '').split(','); | ||
|
||
const samlAudience = process.env.SAML_AUDIENCE; | ||
const preLoadedConfig = process.env.PRE_LOADED_CONFIG; | ||
|
||
const idpEnabled = !!process.env.IDP_ENABLED; | ||
const db = { | ||
engine: process.env.DB_ENGINE ? <DatabaseEngine>process.env.DB_ENGINE : undefined, | ||
url: process.env.DB_URL, | ||
type: process.env.DB_TYPE ? <DatabaseType>process.env.DB_TYPE : undefined, | ||
ttl: process.env.DB_TTL ? Number(process.env.DB_TTL) : undefined, | ||
encryptionKey: process.env.DB_ENCRYPTION_KEY, | ||
}; | ||
|
||
export default { | ||
hostUrl, | ||
hostPort, | ||
externalUrl, | ||
samlPath, | ||
samlAudience, | ||
preLoadedConfig, | ||
apiKeys, | ||
idpEnabled, | ||
db, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import jackson, { IAPIController, IOAuthController } from '@boxyhq/saml-jackson'; | ||
import env from '@lib/env'; | ||
|
||
let apiController: IAPIController; | ||
let oauthController: IOAuthController; | ||
|
||
const g = global as any; | ||
|
||
export default async function init() { | ||
if (!g.apiController || !g.oauthController) { | ||
const ret = await jackson(env); | ||
apiController = ret.apiController; | ||
oauthController = ret.oauthController; | ||
g.apiController = apiController; | ||
g.oauthController = oauthController; | ||
} else { | ||
apiController = g.apiController; | ||
oauthController = g.oauthController; | ||
} | ||
|
||
return { | ||
apiController, | ||
oauthController, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import Cors from 'cors'; | ||
import { NextApiRequest, NextApiResponse } from 'next'; | ||
|
||
// Initializing the cors middleware | ||
const corsFunction = Cors({ | ||
methods: ['GET', 'HEAD'], | ||
}); | ||
|
||
// Helper method to wait for a middleware to execute before continuing | ||
// And to throw an error when an error happens in a middleware | ||
function runMiddleware(req: NextApiRequest, res: NextApiResponse, fn: any) { | ||
return new Promise((resolve, reject) => { | ||
fn(req, res, (result: any) => { | ||
if (result instanceof Error) { | ||
return reject(result); | ||
} | ||
|
||
return resolve(result); | ||
}); | ||
}); | ||
} | ||
|
||
export async function cors(req: NextApiRequest, res: NextApiResponse) { | ||
return await runMiddleware(req, res, corsFunction); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/image-types/global" /> | ||
|
||
// NOTE: This file should not be edited | ||
// see https://nextjs.org/docs/basic-features/typescript for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/** @type {import('next').NextConfig} */ | ||
module.exports = { | ||
reactStrictMode: true, | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module.exports = { | ||
env: { | ||
es2021: true, | ||
node: true, | ||
}, | ||
parserOptions: { | ||
ecmaVersion: 13, | ||
sourceType: 'module', | ||
}, | ||
root: true, | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['@typescript-eslint'], | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'prettier', | ||
'next/core-web-vitals', | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
.vscode | ||
.nyc_output | ||
_config | ||
dist | ||
.DS_Store | ||
/node_modules | ||
**/node_modules/** |
Oops, something went wrong.