Skip to content

Commit 65ebc03

Browse files
committed
minor #12052 [Dotenv] Added a note about the order of env vars (javiereguiluz)
This PR was merged into the 3.4 branch. Discussion ---------- [Dotenv] Added a note about the order of env vars Fixes #12008. Commits ------- f462027 [Dotenv] Added a note about the order of env vars
2 parents 3c9995a + f462027 commit 65ebc03

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

components/dotenv.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,14 @@ Use environment variables in values by prefixing variables with ``$``:
9797
DB_USER=root
9898
DB_PASS=${DB_USER}pass # Include the user as a password prefix
9999
100+
.. note::
101+
102+
The order is important when some env var depends on the value of other env
103+
vars. In the above example, ``DB_PASS`` must be defined after ``DB_USER``.
104+
Moreover, if you define multiple ``.env`` files and put ``DB_PASS`` first,
105+
its value will depend on the ``DB_USER`` value defined in other files
106+
instead of the value defined in this file.
107+
100108
Embed commands via ``$()`` (not supported on Windows):
101109

102110
.. code-block:: terminal

0 commit comments

Comments
 (0)