doc: environment vars syntax

This commit is contained in:
Éloi Rivard 2024-09-13 15:41:42 +02:00
parent 001d635295
commit c5317b7f5b
No known key found for this signature in database
GPG key ID: 7EDA204EA57DD184

View file

@ -28,11 +28,23 @@ Environment variables
In addition, parameters that have not been set in the configuration file can be read from environment variables.
The way environment variables are parsed can be read from the `pydantic-settings documentation <https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values>`_.
.. tip::
For environment vars, the separator between sections and variables is a double underscore: ``__``.
For instance, the ``NAME`` var in the ``CANAILLE`` section shown above is ``CANAILLE__NAME``.
Environment file
================
Any environment variable can also be written in a ``.env``, and will be read if present.
.. code-block:: bash
:caption: .env
SECRET_KEY="very-secret"
CANAILLE__NAME="My organization"
CANAILLE_SQL__DATABASE_URI="postgresql://user:password@localhost/database"
.. TODO: Uncomment this when pydantic-settings implements nested secrets directories
https://github.com/pydantic/pydantic-settings/issues/154