Skip to content

Commit c9ff43e

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

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

configuration.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -932,6 +932,28 @@ 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`` environment variable to the path and
941+
filename of the file where the environment variables are stored. Symfony will
942+
then look for the environment variables in that file, but also in the local
943+
and 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 environment variable is used to find the files where you
948+
application environment variable are store, it must be defined at the
949+
system level (e.g. in your web server configuration) and not in the
950+
``.env`` files.
951+
952+
.. versionadded:: 7.1
953+
954+
The support for the ``SYMFONY_DOTENV_PATH`` environment variable was
955+
introduced in Symfony 7.1.
956+
935957
.. _configuration-secrets:
936958

937959
Encrypting Environment Variables (Secrets)

0 commit comments

Comments
 (0)