From aacd140ba13c02d21976f67b86ff85dcff34a66d Mon Sep 17 00:00:00 2001 From: Bero Date: Thu, 18 Jan 2024 15:34:51 +0100 Subject: [PATCH] fix(expand): expand after all configs are loaded --- cli.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cli.js b/cli.js index 8ea2b15..e1f6140 100755 --- a/cli.js +++ b/cli.js @@ -80,11 +80,15 @@ if (argv.debug) { } paths.forEach(function (env) { - var 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) {