KasperK
Deno13mo ago
Kasper

env vars interpolation across multiple --env-file

I have two env files:
.env1
.env2

.env1 contains FOO=foo
.env2 contains BAR=${FOO}bar

My example program.ts:
console.log(Deno.env.get("FOOBAR"))


If I run
deno run --env-file=.env1 --env-file=.env2 program.ts
I expect to see "foobar" as the output

Instead I see
bar
, which means
${FOO}
was clearly interpolated, but the value was missing. So this leads me to believe that the variables from previous env files are not available in subsequent env files.
is this true?
Is this a bug or intentionally designed this way?
Was this page helpful?