Skip to content

[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

Closed
wants to merge 1 commit into from

Conversation

weaverryan
Copy link
Member

There are a few more proposed .env changes. Yes, I know - I'm hoping these are the last ones, to finally have a simple, non-changing solution :).

The overall picture now looks like this:

A) .env files are always loaded. Simple. No exceptions, no logic.
B) When deploying, there is an optional command in Flex to dump your .env files to an optimized version, if you don't want the overhead of reading these at runtime or don't want DotEnv to be installed on production.

References:

  1. .env being always loaded after proposed recipe Always load vars defined in .env files, providing .env.local.php for prod recipes#501
  2. A new command to dump an optimized version of those env vars Add "dump-env" command to compile .env files to .env.local.php flex#449
  3. A new command to update your recipes Implement "sync-recipes --force" option flex#439

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
* 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``
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be

Suggested change
* E) `One further change to the recipe in December 2019`_ means that your ``.env``
* E) `One further change to the recipe in December 2018`_ means that your ``.env``

?


.. code-block:: terminal

# Unix
Copy link
Contributor

@alexislefebvre alexislefebvre Dec 19, 2018

Choose a reason for hiding this comment

The 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?

Summary of the Changes
~~~~~~~~~~~~~~~~~~~~~~

IF you want to manually update your application, here the details: these changes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
IF you want to manually update your application, here the details: these changes
If you want to manually update your application, here the details: these changes

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.. _`One further change to the recipe in December 2019`: https://github.com/symfony/recipes/pull/501
.. _`One further change to the recipe in December 2018`: https://github.com/symfony/recipes/pull/501

weaverryan added a commit that referenced this pull request Jan 5, 2019
…loaded (weaverryan)

This PR was merged into the 4.1 branch.

Discussion
----------

Documenting changes recipe 501 - where .env is always loaded

See symfony/recipes#501

This basically documents *part* of what is included in #10793. That PR also documents the Flex `composer sync-recipes --force` and `composer dump-env prod`  commands, neither of which exist yet. When those are merged / tagged, I'll finish that PR.

Note: after merging to 4.2, the URLs at the bottom of `dot-env-changes` need to be changed to point to the 4.2 recipes.

Thanks!

Commits
-------

203d93a Documenting changes recipe 501 - where .env is always loaded
@javiereguiluz
Copy link
Member

All related PRs have been merged, so we can work on finishing this. Thanks!

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``:
Copy link
Member

Choose a reason for hiding this comment

The 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?

$ git mv .env.dist .env

# Windows
$ mv .env .env.local
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we keep it, it's rename on windows? or we rely on the fact that if git is installed, so is mv?

@javiereguiluz javiereguiluz added the ⭐️ EU-FOSSA Hackathon https://symfony.com/blog/the-symfony-and-api-platform-hackathon-is-coming label Apr 4, 2019
@javiereguiluz
Copy link
Member

Closing as fixed by #11690.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⭐️ EU-FOSSA Hackathon https://symfony.com/blog/the-symfony-and-api-platform-hackathon-is-coming Status: Needs Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants