Skip to content

Commit

Permalink
don't override falsy values in process.env
Browse files Browse the repository at this point in the history
  • Loading branch information
legendar committed Aug 8, 2018
1 parent f315d40 commit f012c66
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/main.js
Expand Up @@ -8,7 +8,7 @@ var dotenvExpand = function (config) {
var key = match.replace(/\$|{|}/g, '')

// process.env value 'wins' over .env file's value
var variable = process.env[key] || config.parsed[key] || ''
var variable = process.env.hasOwnProperty(key) ? process.env[key] : (config.parsed[key] || '')

// Resolve recursive interpolations
variable = interpolate(variable)
Expand All @@ -20,7 +20,7 @@ var dotenvExpand = function (config) {
}

for (var configKey in config.parsed) {
var value = process.env[configKey] || config.parsed[configKey]
var value = process.env.hasOwnProperty(configKey) ? process.env[configKey] : config.parsed[configKey]

if (config.parsed[configKey].substring(0, 2) === '\\$') {
config.parsed[configKey] = value.substring(1)
Expand Down

0 comments on commit f012c66

Please sign in to comment.