Skip to content

Commit

Permalink
fix: Won't start when no config file specified on command line
Browse files Browse the repository at this point in the history
Incorrect use of NODE_CONFIG_DIR and NODE_ENV environment variables
  • Loading branch information
Göran Sander committed Aug 21, 2023
1 parent ca03bf3 commit d1d0090
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ if (options.configfile && options.configfile.length > 0) {
}
}

// Set global variable conttaining the name and full pathof the config file
// Set global variable conttaining the name and full path of the config file
const configFile = path.join(
process.env.NODE_CONFIG_DIR,
process.env.NODE_ENV + configFileExtension
`${process.env.NODE_ENV}.${configFileExtension}`
);

// Are we running as standalone app or not?
Expand Down Expand Up @@ -148,6 +148,13 @@ const logger = winston.createLogger({
),
});

// Show contents of environment variables controlling config file location and name
logger.debug(`NODE_CONFIG_DIR: ${process.env.NODE_CONFIG_DIR}`);
logger.debug(`NODE_ENV: ${process.env.NODE_ENV}`);

// Output config file name and path to log
logger.info(`Using config file: ${configFile}`);

// Function to get current logging level
const getLoggingLevel = () => logTransports.find((transport) => transport.name === 'console').level;

Expand Down

0 comments on commit d1d0090

Please sign in to comment.