Skip to content
Prev Previous commit
Next Next commit
Update docs
  • Loading branch information
rmk135 committed Jun 13, 2021
commit cb248e0ccefdeb0d53b1ecf6b2cf8d90cf265fa4
32 changes: 26 additions & 6 deletions docs/providers/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,18 @@ where ``examples/providers/configuration/config.ini`` is:
:language: ini

:py:meth:`Configuration.from_ini` method supports environment variables interpolation. Use
``${ENV_NAME}`` format in the configuration file to substitute value of the environment
variable ``ENV_NAME``.
``${ENV_NAME}`` format in the configuration file to substitute value from ``ENV_NAME`` environment
variable.

You can also specify a default value using ``${ENV_NAME:default}`` format. If environment
variable ``ENV_NAME`` is undefined, configuration provider will substitute value ``default``.

.. code-block:: ini

[section]
option1 = {$ENV_VAR}
option2 = {$ENV_VAR}/path
option3 = {$ENV_VAR:default}

Loading from a YAML file
------------------------
Expand All @@ -62,12 +72,22 @@ where ``examples/providers/configuration/config.yml`` is:
.. literalinclude:: ../../examples/providers/configuration/config.yml
:language: ini

:py:meth:`Configuration.from_yaml` method uses custom version of ``yaml.SafeLoader``.
:py:meth:`Configuration.from_yaml` method supports environment variables interpolation. Use
``${ENV_NAME}`` format in the configuration file to substitute value from ``ENV_NAME`` environment
variable.

The loader supports environment variables interpolation. Use ``${ENV_NAME}`` format
in the configuration file to substitute value of the environment variable ``ENV_NAME``.
You can also specify a default value using ``${ENV_NAME:default}`` format. If environment
variable ``ENV_NAME`` is undefined, configuration provider will substitute value ``default``.

You can also specify a YAML loader as an argument:
.. code-block:: ini

section:
option1: {$ENV_VAR}
option2: {$ENV_VAR}/path
option3: {$ENV_VAR:default}

:py:meth:`Configuration.from_yaml` method uses custom version of ``yaml.SafeLoader``.
To use another loader use ``loader`` argument:

.. code-block:: python

Expand Down