mirror of
https://github.com/unraid/api.git
synced 2026-04-28 03:01:12 -05:00
fix: use env from user before flag
This commit is contained in:
+3
-2
@@ -62,7 +62,8 @@ const options: ArgsParseOptions<Flags> = {
|
||||
const mainOptions = parse<Flags>(args, { ...options, partial: true, stopAtFirstUnknown: true });
|
||||
const commandOptions = (mainOptions as Flags & { _unknown: string[] })._unknown || [];
|
||||
const command: string = (mainOptions as any).command;
|
||||
const environment = mainOptions.environment ?? 'production';
|
||||
// Use the env passed by the user, then the flag inline, then default to production
|
||||
const environment = process.env.ENVIRONMENT ?? mainOptions.environment ?? 'production';
|
||||
const getUnraidApiPid = async () => {
|
||||
// Find all processes called "unraid-api" which aren't this process
|
||||
const pids = await findProcess('name', 'unraid-api', true);
|
||||
@@ -90,7 +91,7 @@ const commands = {
|
||||
setEnv('LOG_TRANSPORT', mainOptions['log-transport']);
|
||||
setEnv('PORT', mainOptions.port);
|
||||
|
||||
console.log(`Starting unraid-api in "${process.env.ENVIRONMENT!}" mode.`);
|
||||
console.log(`Starting unraid-api in "${environment}" mode.`);
|
||||
|
||||
// Load bundled index file
|
||||
const indexPath = './index.js';
|
||||
|
||||
Reference in New Issue
Block a user