8000 [Dotenv] Added a note about the order of env vars · symfony/symfony-docs@f462027 · GitHub
[go: up one dir, main page]

Skip to content

Commit f462027

Browse files
committed
[Dotenv] Added a note about the order of env vars
1 parent 9947271 commit f462027

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)
0