Skip to content

Commit

Permalink
Gh issue 3456 update environment variable documentation (#3482)
Browse files Browse the repository at this point in the history
* Fix typos

* Fix docs for retrieving missing environment variable.

Fixes #3456
  • Loading branch information
jugmac00 authored Feb 15, 2025
1 parent 28212ab commit 65d404e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/changelog/3456.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updates the documentation for ``os.environ['KEY']`` when the variable does not exist - by :user:`jugmac00`.
7 changes: 4 additions & 3 deletions docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1635,7 +1635,8 @@ If you specify a substitution string like this::

{env:KEY}

then the value will be retrieved as ``os.environ['KEY']`` and raise an Error if the environment variable does not exist.
then the value will be retrieved as ``os.environ['KEY']`` and replaced with an empty string if the environment variable
does not exist.


Environment variable substitutions with default values
Expand All @@ -1645,14 +1646,14 @@ If you specify a substitution string like this::

{env:KEY:DEFAULTVALUE}

then the value will be retrieved as ``os.environ['KEY']`` and replace with DEFAULTVALUE if the environment variable does
then the value will be retrieved as ``os.environ['KEY']`` and replaced with DEFAULTVALUE if the environment variable does
not exist.

If you specify a substitution string like this::

{env:KEY:}

then the value will be retrieved as ``os.environ['KEY']`` and replace with an empty string if the environment variable
then the value will be retrieved as ``os.environ['KEY']`` and replaced with an empty string if the environment variable
does not exist.

Substitutions can also be nested. In that case they are expanded starting from the innermost expression::
Expand Down

0 comments on commit 65d404e

Please sign in to comment.