From ad278c06952a550f6ac030fff664f88a0f093139 Mon Sep 17 00:00:00 2001 From: Berislav Hunjadi Date: Fri, 20 Dec 2024 16:14:24 +0100 Subject: [PATCH] fix(expand): expand after all configs are loaded (#101) Co-authored-by: Bero --- cli.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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) {