@@ -4,7 +4,16 @@ const { hideBin } = require('yargs/helpers');
44const { ComponentsManager } = require ( 'componentsjs' ) ;
55const { setGlobalLoggerFactory, WinstonLoggerFactory } = require ( 'global-logger-factory' ) ;
66
7+ const rootDir = path . join ( __dirname , '../' ) ;
8+
79const argv = yargs ( hideBin ( process . argv ) )
10+ . option ( 'config' , {
11+ alias : 'c' ,
12+ type : 'string' ,
13+ array : true ,
14+ description : 'Components.js configuration file path(s)' ,
15+ default : [ path . join ( rootDir , './config/default.json' ) ]
16+ } )
817 . option ( 'port' , {
918 alias : 'p' ,
1019 type : 'number' ,
@@ -32,16 +41,14 @@ const argv = yargs(hideBin(process.argv))
3241 . alias ( 'help' , 'h' )
3342 . argv ;
3443
35- const rootDir = path . join ( __dirname , '../' ) ;
36-
3744const launch = async ( ) => {
3845 const variables = { } ;
3946
4047 variables [ 'urn:uma:variables:port' ] = argv . port ;
4148 variables [ 'urn:uma:variables:baseUrl' ] = argv . baseUrl ?? `http://localhost:${ argv . port } /uma` ;
4249 variables [ 'urn:uma:variables:backupFilePath' ] = argv . backupFilePath ;
43-
44- const configPath = path . join ( rootDir , './config/default.json' ) ;
50+ // Debug edge case for demo config
51+ variables [ 'urn:uma:variables:policyContainer' ] = 'http://localhost:3000/settings/policies/' ;
4552
4653 setGlobalLoggerFactory ( new WinstonLoggerFactory ( argv . loggingLevel ) ) ;
4754
@@ -51,7 +58,9 @@ const launch = async () => {
5158 typeChecking : false ,
5259 } ) ;
5360
54- await manager . configRegistry . register ( configPath ) ;
61+ for ( const configPath of argv . config ) {
62+ await manager . configRegistry . register ( configPath ) ;
63+ }
5564
5665 const umaServer = await manager . instantiate ( 'urn:uma:default:App' , { variables} ) ;
5766 await umaServer . start ( ) ;
0 commit comments