diff --git a/dev/build/config.yml b/dev/build/config.yml index 6f1a61b497..d9e58761a1 100644 --- a/dev/build/config.yml +++ b/dev/build/config.yml @@ -15,6 +15,6 @@ ssl: provider: letsencrypt domain: $(LETSENCRYPT_DOMAIN) subscriberEmail: $(LETSENCRYPT_EMAIL) -logLevel: info -logFormat: $(LOG_FORMAT) +logLevel: $(LOG_LEVEL:info) +logFormat: $(LOG_FORMAT:default) ha: $(HA_ACTIVE) diff --git a/server/helpers/config.js b/server/helpers/config.js index 0e6ab56364..6f972d40df 100644 --- a/server/helpers/config.js +++ b/server/helpers/config.js @@ -8,14 +8,18 @@ module.exports = { /** * Parse configuration value for environment vars * + * Replaces `$(ENV_VAR_NAME)` with value of `ENV_VAR_NAME` environment variable. + * + * Also supports defaults by if provided as `$(ENV_VAR_NAME:default)` + * * @param {any} cfg Configuration value * @returns Parse configuration value */ parseConfigValue (cfg) { return _.replace( cfg, - /\$\(([A-Z0-9_]+)\)/g, - (fm, m) => { return process.env[m] } + /\$\(([A-Z0-9_]+)(?::(.+))?\)/g, + (fm, m, d) => { return process.env[m] || d } ) },