Duxis config package
Loads configuration for use with Duxis.
Examples:
// config.js somewhere in SETUP_PATHS:
module.exports = {
foo: {
bar: 123.456
}
}
// somewhere.js:
const config = require('@imec/duxis-config');
const bar = config.get('foo.bar'); // bar = 123.456
const baz = config.get('foo.baz', 'does not exist'); // baz = 'does not exist'
const other = config.get('foo.other'); // throws error
{
duxis: {
api: {
// The value for the `formLimit` option for the body parser middleware provided by
// `koa-bodyparser`:
formLimit: string, // default = '56kb'
},
// This part of the duxis.auth config should be included in all cargo services.
// Duxis-Auth-specific config is provided in `system-images/duxis-auth/setup`.
auth: {
// The url of the exposed auth api, meant to be accessed by frontend clients:
apiUrl: string, // required
disable: boolean, // default = false
// The default identity provider setup:
identityProviders: {
// Enable this provider to use the built-in username/password-based authentication.
// Note that this provider is not ready for production.
simplePassword: {
enable: boolean, // default = false
module: string, // default = './idProviders/SimplePasswordIdProvider'
},
// See docs/dev/dxAuth-auth0.md for more details:
auth0: {
enable: boolean, // default = false
enableRenew: boolean, // default = false
jwksUri: string, // default = ''
module: string, // default = './idProviders/Auth0IdProvider'
syncRoles: boolean, // default = true
useProviderId: boolean, // default = true
webAuth: {
// See https://auth0.com/docs/libraries/auth0js/v8#available-parameters
audience: string, // default = ''
authCallbackRoute: string, // default = '/auth0/auth-callback'
clientHost: string: // default = ''
// See https://auth0.com/docs/libraries/auth0js/v8#available-parameters
clientID: string, // default = ''
// See https://auth0.com/docs/libraries/auth0js/v8#available-parameters
domain: string, // default = ''
renewCallbackRoute: string, // default = '/auth0/silent-callback'
// See https://auth0.com/docs/libraries/auth0js/v8#available-parameters
responseType: string, // default = 'token id_token'
// See https://auth0.com/docs/libraries/auth0js/v8#available-parameters
scope: string, // default = 'openid profile http://auth.duxis.io/roles'
},
},
},
jwt: {
// The JWT secret used by the DxAuth framework:
secret: string, // default = 'secret-string-xyz'
expiresIn: number, // default = 60 * 60 * 24
},
// The URL of the main auth API for local access:
localApiUrl: string, // default = 'http://${process.env.COMPOSE_PROJECT_NAME}-auth/auth'
// The path to navigate to when signing out:
signOutTargetPath: string, // default = '/'
// The URL of the protected system auth API:
sysApiUrl: string, // default = 'http://${process.env.COMPOSE_PROJECT_NAME}-auth:8001/auth'
// The number of seconds the dxToken remains valid:
tokenExpiration: number, // default = 5 * 60
},
// Redis message broker configuration:
// (only valid if using the @imec/duxis-redis-broker package)
broker: {
// The name of the broker service, which can be used to access the broker api from services on
// the same Docker network as the broker service:
host: string, // default = 'broker'
},
dxHost: string, // default = process.env.DX_HOST
dxVersion: string, // default = process.env.DX_VERSION
schema: {
metaSchema: {
// The path (in the container) to the dxMetaSchema:
path: string, // default = '/cargo/setup/cargo-base/schemas/dx'
// The id of the dxMetaSchema:
id: string, // default = 'http://duxis.io/schemas/dx'
},
// The path (in the container) to the DxSchema:
path: string, // default = '/cargo/setup/project/dxSchema/schema.json'
},
},
// Log4js internal duxis logging default configuration
log4js: {
appenders: {
console: { type: 'console', layout: { type: 'coloured' } },
},
categories: {
default: { appenders: ['console'], level: 'info' },
},
},
}