From f012c66432f48a057f395f4c7cbde6dc1383f013 Mon Sep 17 00:00:00 2001 From: Yaroslav Shulika Date: Wed, 8 Aug 2018 16:07:05 +0300 Subject: [PATCH] don't override falsy values in process.env --- lib/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/main.js b/lib/main.js index c9c18b1..2fcedbd 100644 --- a/lib/main.js +++ b/lib/main.js @@ -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) @@ -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)