Skip to content

Commit 61d6eb0

Browse files
committed
Update deployment docs with new .env loading
1 parent 67f3845 commit 61d6eb0

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

deployment.rst

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

133133
1. Create "real" environment variables. How you set environment variables, depends
134134
on your setup: they can be set at the command line, in your Nginx configuration,
135-
or via other methods provided by your hosting service.
135+
or via other methods provided by your hosting service (see note below)
136136

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

139139
There is no significant advantage to either of the two options: use whatever is
140140
most natural in your hosting environment.
141141

142142
.. note::
143143

144-
If you use the ``.env.*`` files on production, you may need to move your
145-
``symfony/dotenv`` dependency from ``require-dev`` to ``require`` in ``composer.json``:
144+
If you use "real" environment variables on production you might not want your
145+
application to process the ``.env.*`` files on every request. You can generate
146+
an optimized ``.env.local.php`` which overrides all other configuration files:
146147

147148
.. code-block:: terminal
148149
149-
$ composer remove symfony/dotenv
150-
$ composer require symfony/dotenv
150+
$ composer dump-env prod
151+
152+
The generated file will contain all the configuration stored in ``.env``. If you
153+
want to rely only on environment variables, generate one without any values using:
154+
155+
.. code-block:: terminal
156+
157+
$ composer dump-env prod --empty
151158
152159
C) Install/Update your Vendors
153160
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)