Skip to content

Commit bb3f770

Browse files
committed
Update documentation
1 parent 1d979f0 commit bb3f770

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/providers/configuration.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,21 @@ where ``examples/providers/configuration/config.ini`` is:
4545
.. literalinclude:: ../../examples/providers/configuration/config.ini
4646
:language: ini
4747

48+
Alternatively, you can provide a path to the INI file over the configuration provider argument. In that case,
49+
the container will call ``config.from_ini()`` automatically:
50+
51+
.. code-block:: python
52+
:emphasize-lines: 3
53+
54+
class Container(containers.DeclarativeContainer):
55+
56+
config = providers.Configuration(ini_files=["./config.ini"])
57+
58+
59+
if __name__ == "__main__":
60+
container = Container() # Config is loaded from ./config.ini
61+
62+
4863
:py:meth:`Configuration.from_ini` method supports environment variables interpolation.
4964

5065
.. code-block:: ini

0 commit comments

Comments
 (0)