Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a0320fd

Browse files
committed
Added small section about default values
1 parent 54878b2 commit a0320fd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

components/dotenv.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,13 @@ Use environment variables in values by prefixing variables with ``$``:
141141
DB_USER=root
142142
DB_PASS=${DB_USER}pass # Include the user as a password prefix
143143
144+
Define a default value in case the environment variable is not set:
145+
146+
.. code-block:: terminal
147+
148+
DB_USER=
149+
DB_PASS=${DB_USER:-root}pass # results in DB_PASS=rootpass
150+
144151
Embed commands via ``$()`` (not supported on Windows):
145152

146153
.. code-block:: terminal

0 commit comments

Comments
 (0)