Skip to content

Commit 46ebb09

Browse files
committed
feature #11956 Added small section about default values (j92)
This PR was merged into the 4.4 branch. Discussion ---------- Added small section about default values <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/roadmap for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> Added a short description and a code sample of how to use default values when referenced variables are not set. The feature PR is symfony/symfony#31546. Commits ------- 1848e00 Added small section about default values
2 parents b47f5c8 + 1848e00 commit 46ebb09

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
@@ -149,6 +149,13 @@ Use environment variables in values by prefixing variables with ``$``:
149149
its value will depend on the ``DB_USER`` value defined in other files
150150
instead of the value defined in this file.
151151

152+
Define a default value in case the environment variable is not set:
153+
154+
.. code-block:: terminal
155+
156+
DB_USER=
157+
DB_PASS=${DB_USER:-root}pass # results in DB_PASS=rootpass
158+
152159
Embed commands via ``$()`` (not supported on Windows):
153160

154161
.. code-block:: terminal

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy