diff --git a/cli.js b/cli.js index c1c7c21..2ac3956 100755 --- a/cli.js +++ b/cli.js @@ -81,11 +81,15 @@ if (argv.debug) { } paths.forEach(function (env) { - const parsedFile = dotenv.config({ path: path.resolve(env), override }) - if (argv.expand !== false) { - dotenvExpand(parsedFile) - } + dotenv.config({ path: path.resolve(env), override }) }) + +// Expand when all path configs are loaded +if (argv.expand !== false) { + dotenvExpand({ + parsed: process.env + }); +} Object.assign(process.env, parsedVariables) if (argv.p) {