Closed
Description
Hi.
Recently I've ran into an issue where I didn't realize that order of environment variables within a dotenv file matters. For example, having two files, .env
and .env.local
with:
.env
A=C
B=D
.env.local
TESTVAR=$A-$B
A=E
B=F
results in TESTVAR
resolving to C-D
, basically taking the variables from .env
file as they are defined before the TESTVAR
itself. However, when moving the TESTVAR
variable to the bottom of the file:
A=E
B=F
TESTVAR=$A-$B
makes the TESTVAR
variable resolve to E-F
, because now the new values are defined earlier.
Should something like this be documented?
Thanks!