-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[WIP] Updating docs for a few more .env changes #10793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
1) .env being always loaded after proposed recipe 2) A new command to dump an optimized version of those env vars 3) A new command to update your recipes
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -30,19 +30,59 @@ important changes: | |||||
other environments. You can also create a ``.env.test`` file for test-environment | ||||||
overrides. | ||||||
|
||||||
* E) If you pass the ``--env=`` flag when running ``bin/console``, this value will | ||||||
override your ``APP_ENV`` environment variable (if set). And so, if you pass | ||||||
``--env=prod``, the DotEnv component *will* try to load your ``.env*`` files. | ||||||
* E) `One further change to the recipe in December 2019`_ means that your ``.env`` | ||||||
files are *always* loaded, even if you set an ``APP_ENV=prod`` environment | ||||||
variable. The purpose is for the ``.env`` files to define default values that | ||||||
you can override if you want to with real environment values. | ||||||
|
||||||
There are a few other improvements, but these are the most important. To take advantage | ||||||
of these, you *will* need to modify a few files in your existing app. | ||||||
|
||||||
Updating My Application | ||||||
----------------------- | ||||||
|
||||||
If you created your application after November 15th 2018, you don't need to make | ||||||
any changes! Otherwise, here is the list of changes you'll need to make - these | ||||||
changes can be made to any Symfony 3.4 or higher app: | ||||||
First, make sure you're using ``symfony/flex`` version 1.2 or later: | ||||||
|
||||||
.. code-block:: terminal | ||||||
|
||||||
composer update symfony/flex | ||||||
|
||||||
The easiest way to update your application is to update all of your recipes using | ||||||
the :ref:`sync-recipes <updating-recipes>` command. This command will update *all* | ||||||
your recipes, so it will probably include other changes beyond the ones needed for | ||||||
the new environment handling. | ||||||
|
||||||
First, rename ``.env`` to ``.env.local`` and ``.env.dist`` to ``.env``: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure this is needed: the command already does the rename, isn't it? |
||||||
|
||||||
.. code-block:: terminal | ||||||
|
||||||
# Unix | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why have 2 sections when the commands are the same for Unix and Windows? |
||||||
$ mv .env .env.local | ||||||
$ git mv .env.dist .env | ||||||
|
||||||
# Windows | ||||||
$ mv .env .env.local | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we keep it, it's |
||||||
$ git mv .env.dist .env | ||||||
|
||||||
Now run: | ||||||
|
||||||
.. code-block:: terminal | ||||||
|
||||||
$ composer sync-recipes --force | ||||||
|
||||||
If this asks you to overwrite uncommited changes in ``.env``, choose "no" - you | ||||||
should keep the values from your ``.env`` file. | ||||||
|
||||||
When the command finishes, review the changes - there may be extra files or changes | ||||||
from other recipes that you don't want. If you made custom changes to files, you'll | ||||||
need to use re-add those (hint using ``git diff`` is a great way to see the changes | ||||||
made by the recipes). | ||||||
|
||||||
Summary of the Changes | ||||||
~~~~~~~~~~~~~~~~~~~~~~ | ||||||
|
||||||
IF you want to manually update your application, here the details: these changes | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
can be made to any Symfony 3.4 or higher app: | ||||||
|
||||||
#. Create a new `config/bootstrap.php`_ file in your project. This file loads Composer's | ||||||
autoloader and loads all the ``.env`` files as needed (note: in an earlier recipe, | ||||||
|
@@ -94,3 +134,4 @@ changes can be made to any Symfony 3.4 or higher app: | |||||
.. _`comment on the top of .env`: https://github.com/symfony/recipes/blob/master/symfony/flex/1.0/.env | ||||||
.. _`create a new .env.test`: https://github.com/symfony/recipes/blob/master/symfony/phpunit-bridge/3.3/.env.test | ||||||
.. _`phpunit.xml.dist file`: https://github.com/symfony/recipes/blob/master/symfony/phpunit-bridge/3.3/phpunit.xml.dist | ||||||
.. _`One further change to the recipe in December 2019`: https://github.com/symfony/recipes/pull/501 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Upgrading Flex Recipes | ||
~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Some :doc:`Flex Recipes </setup/flex>` for packages you've already installed may | ||
also be out of date. You don't need to update these, but it's a great way to keep | ||
your code updated with the latest features and conventions. | ||
|
||
See :ref:`updating-recipes` for details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be
?