Skip to content

[Dotenv] Should we document that order of environment variables within the dotenv file matters? #12008

Closed
@emodric

Description

@emodric

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!

Metadata

Metadata

Assignees

Labels

DotenvhasPRA Pull Request has already been submitted for this issue.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions