From dd8cc832cdd181ca3a9b476f044c223b0f859347 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Mon, 13 Feb 2017 21:19:22 +0100 Subject: [PATCH] Fix dotenv now.json option behaviour (#304) --- bin/now-deploy.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bin/now-deploy.js b/bin/now-deploy.js index 2136925..2fc6f60 100755 --- a/bin/now-deploy.js +++ b/bin/now-deploy.js @@ -372,13 +372,16 @@ async function sync(token) { const now = new Now(apiUrl, token, {debug}) let dotenvConfig + let dotenvOption if (argv.dotenv) { - if (nowConfig.dotenv) { - argv.dotenv = nowConfig.dotenv - } + dotenvOption = argv.dotenv + } else if (nowConfig && nowConfig.dotenv) { + dotenvOption = nowConfig.dotenv + } - const dotenvFileName = typeof argv.dotenv === 'string' ? argv.dotenv : '.env' + if (dotenvOption) { + const dotenvFileName = typeof dotenvOption === 'string' ? dotenvOption : '.env' if (!fs.existsSync(dotenvFileName)) { error(`--dotenv flag is set but ${dotenvFileName} file is missing`)