Skip to content
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

Add "dump-env" command to compile .env files to .env.local.php #449

Merged
merged 2 commits into from
Jan 21, 2019
Merged

Add "dump-env" command to compile .env files to .env.local.php #449

merged 2 commits into from
Jan 21, 2019

Conversation

nicolas-grekas
Copy link
Member

This adds a new command that compiles .env files to .env.local.php:

$ composer dump-env prod
Successfully dumped .env files in .env.local.php

The generated file is used in symfony/recipes#501

src/Command/DumpEnvCommand.php Outdated Show resolved Hide resolved
@lyrixx
Copy link
Member

lyrixx commented Jan 2, 2019

Why is this a composer command? IMHO it should be a Symfony command (bin/console env:dump prod)

@nicolas-grekas
Copy link
Member Author

At least because we want to ship this for all Symfony versions without waiting for 4.3.

@lyrixx
Copy link
Member

lyrixx commented Jan 2, 2019

This seems a hack to me. If we go in that sens, we will move many code here.
I understand the reason, but I don't like the implementation :/
What about a symfony/backport ?

Of course I'm not strongly against this hack, but if we could find a better alternative, this will be much better

@nicolas-grekas
Copy link
Member Author

nicolas-grekas commented Jan 2, 2019

Please, not another package to maintain. If you want, you can provide a command to 4.3 and then we could deprecate this one. Personally, I don't think it's worth the effort. dump-autoload is a Composer command, so would be dump-env. Both are run at the same stage, looks consistent to me.

@nicolas-grekas
Copy link
Member Author

Thank you @renanbr.

@nicolas-grekas nicolas-grekas merged commit 7e561d5 into symfony:master Jan 21, 2019
nicolas-grekas added a commit that referenced this pull request Jan 21, 2019
…al.php (nicolas-grekas, renanbr)

This PR was merged into the 1.2-dev branch.

Discussion
----------

Add "dump-env" command to compile .env files to .env.local.php

This adds a new command that compiles .env files to .env.local.php:
```
$ composer dump-env prod
Successfully dumped .env files in .env.local.php
```

The generated file is used in symfony/recipes#501

Commits
-------

7e561d5 add --empty option
31b12b1 Add "dump-env" command to compile .env files to .env.local.php
@nicolas-grekas nicolas-grekas deleted the dump-env branch February 12, 2019 16:55
@Bilge
Copy link

Bilge commented Jun 10, 2020

I cannot understand the point of this at all. All it does is substitute the APP_ENV var for whatever name you specify (e.g. prod) and pretends that all other dev settings will somehow be suitable for that environment. That is almost never going to be the case, particularly if you have separate dev and production databases, which is fairly common. How are you expected to merge the rest of the production settings into this config, because this command doesn't appear to support that?


Edit: upon further inspection, it appears you are expected to produce either .env.prod or .env.prod.local, to override the dev defaults, but is this documented anywhere? The section specifically titled, Configuring Environment Variables in Production appears to make no reference to it whatsoever.

tgalopin pushed a commit to tgalopin/flex that referenced this pull request Dec 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants