Skip to content

Commit 053a657

Browse files
[Dotenv] Add SYMFONY_DOTENV_PATH
1 parent 0b70c22 commit 053a657

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

configuration.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -932,6 +932,27 @@ get the environment variables and will not spend time parsing the ``.env`` files
932932
Update your deployment tools/workflow to run the ``dotenv:dump`` command after
933933
each deploy to improve the application performance.
934934

935+
Store Environment Variables In Another File
936+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
937+
938+
By default, the environment variables are stored in the ``.env`` file located
939+
at the root of your project. However, you can store them in another file by
940+
setting the ``SYMFONY_DOTENV_PATH`` env var to the path and filename of the
941+
file where the environment variables are stored. Symfony will then look for
942+
the environment variables in that file, but also in the local and
943+
environment-specific files (e.g. ``.*.local`` and
944+
``.*.<environment>.local``). You can find more information about this
945+
in the :ref:`dedicated section <configuration-multiple-env-files>`.
946+
947+
Because this env var is used to find the the files where you application env
948+
var are store, it must be defined at the system level (e.g. in your web server
949+
configuration) and not in the ``.env`` files.
950+
951+
.. versionadded:: 7.1
952+
953+
The support for the ``SYMFONY_DOTENV_PATH`` env var was introduced in
954+
Symfony 7.1.
955+
935956
.. _configuration-secrets:
936957

937958
Encrypting Environment Variables (Secrets)

0 commit comments

Comments
 (0)