mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: args as env vars
refactor: use constant for env var prefix
This commit is contained in:
parent
df2926a52f
commit
a461586921
@ -65,7 +65,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"usage": "node ./bin/server.js [args]"
|
"usage": "node ./bin/server.js [args]",
|
||||||
|
"envVarPrefix": "CSS",
|
||||||
|
"loadFromEnv": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -22,6 +22,8 @@ const CORE_CLI_PARAMETERS = {
|
|||||||
mainModulePath: { type: 'string', alias: 'm', requiresArg: true },
|
mainModulePath: { type: 'string', alias: 'm', requiresArg: true },
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
const ENV_VAR_PREFIX = 'CSS';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class that can be used to instantiate and start a server based on a Component.js configuration.
|
* A class that can be used to instantiate and start a server based on a Component.js configuration.
|
||||||
*/
|
*/
|
||||||
@ -112,7 +114,9 @@ export class AppRunner {
|
|||||||
.usage('node ./bin/server.js [args]')
|
.usage('node ./bin/server.js [args]')
|
||||||
.options(CORE_CLI_PARAMETERS)
|
.options(CORE_CLI_PARAMETERS)
|
||||||
// We disable help here as it would only show the core parameters
|
// We disable help here as it would only show the core parameters
|
||||||
.help(false);
|
.help(false)
|
||||||
|
// We also read from environment variables
|
||||||
|
.env(ENV_VAR_PREFIX);
|
||||||
|
|
||||||
const params = await yargv.parse();
|
const params = await yargv.parse();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user