DenoDDeno
Powered by
KasperK
Denoβ€’16mo 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"))
console.log(Deno.env.get("FOOBAR"))


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

Instead I see
bar
bar
, which means
${FOO}
${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?
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Deno env vars
isoIiso / help
13mo ago
Deno.env via file
Long ZerLLong Zer / help
3y ago
Using TypeScript with .env file
jamesfoleyJjamesfoley / help
17mo ago