Skip to content

Commit

Permalink
Merge pull request #17 from legendar/patch-1
Browse files Browse the repository at this point in the history
don't override falsy values in process.env
  • Loading branch information
motdotla authored Mar 13, 2019
2 parents f315d40 + f012c66 commit c0bad34
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/main.js
Original file line number Diff line number Diff line change
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 c0bad34

Please sign in to comment.