TaskT
Task2y ago
6 replies
grumpper

dotnev variable value calculation

Hello !

I canot find anything in the docs so I decided to ask here:

Is there some sort of prioirity in the dotenv declaraion?

Like if I declare it to be

['.env', '$HOME/.env']


and have
DEPLOY="true"
in
.env
but
DEPLOY="false"
in
$HOME/.env
what will be the value of
DEPLOY
in the end?

-
true
because
.env
is first so its values take precedence?
-
false
because
$HOME/.env
is last so its value override the rest?
Solution
Hello !
It'll be true. Dotenv files are processed in the order they are defined. If an environment variable already exists, it won't be overridden.
Was this page helpful?