Skip to content

Commit b905b57

Browse files
cristi-contiuwouterj
authored andcommitted
Update deployment docs with new .env loading
1 parent 8548427 commit b905b57

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

deployment.rst

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,21 +126,29 @@ While developing locally, you'll usually store these in ``.env`` and ``.env.loca
126126

127127
1. Create "real" environment variables. How you set environment variables, depends
128128
on your setup: they can be set at the command line, in your Nginx configuration,
129-
or via other methods provided by your hosting service.
129+
or via other methods provided by your hosting service;
130130

131-
2. Or, create a ``.env.local`` file like your local development (see note below)
131+
2. Or, create a ``.env.local`` file like your local development.
132132

133133
There is no significant advantage to either of the two options: use whatever is
134134
most natural in your hosting environment.
135135

136-
.. note::
136+
.. tip::
137+
138+
You might not want your application to process the ``.env.*`` files on
139+
every request. You can generate an optimized ``.env.local.php`` which
140+
overrides all other configuration files:
141+
142+
.. code-block:: terminal
143+
144+
$ composer dump-env prod
137145
138-
If you use the ``.env.*`` files on production, you may need to move your
139-
``symfony/dotenv`` dependency from ``require-dev`` to ``require`` in ``composer.json``:
146+
The generated file will contain all the configuration stored in ``.env``. If you
147+
want to rely only on environment variables, generate one without any values using:
140148

141149
.. code-block:: terminal
142150
143-
$ composer require symfony/dotenv
151+
$ composer dump-env prod --empty
144152
145153
C) Install/Update your Vendors
146154
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)