Skip to content

Commit

Permalink
Support NODE_ENV alt to ENV
Browse files Browse the repository at this point in the history
  • Loading branch information
nonword committed Mar 18, 2024
1 parent 3bccbd3 commit f70907c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/load-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ const { decrypt } = require('./kms-helper')

module.exports.loadConfig = async () => {
// Use `ENV` var to determine what config to load (default production):
const env = process.env.ENV &&
['local', 'qa', 'qa-new-domain', 'production'].includes(process.env.ENV)
? process.env.ENV
// ECS task definition is using NODE_ENV, so we'll support that too for now
const envTag = (process.env.ENV || process.env.NODE_ENV)
const env = envTag &&
['local', 'qa', 'qa-new-domain', 'production'].includes(envTag)
? envTag
: 'production'
const envPath = `config/${env}.env`

Expand All @@ -17,7 +19,7 @@ module.exports.loadConfig = async () => {
// Now that we've loaded env vars, which may include LOG_LEVEL, instantiate logger:
logger.setLevel(process.env.LOG_LEVEL)

logger.info(`Load-config: Loaded ${envPath} for ENV '${process.env.ENV || ''}'`)
logger.info(`Load-config: Loaded ${envPath} for ENV '${envTag || ''}'`)

return await exports.decryptEncryptedConfig()
}
Expand Down

0 comments on commit f70907c

Please sign in to comment.