Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

dsech
Copy link

@dsech dsech commented Feb 9, 2021

symfony/dotenv allows customizing the name of the .env files. Unfortunately, the dump-env command doesn't allow changing the name.

This PR adds a new command option through which the filename can be specified:

> composer dump-env prod --env-file=.env.custom
Successfully dumped .env.custom files in .env.custom.local.php

My specific need at the moment is that I want to reserve the usage of the .env file for docker-compose

@dsech
Copy link
Author

dsech commented Feb 9, 2021

The code style issue reported is not related to this change.

@stof
Copy link
Member

stof commented Feb 9, 2021

yeah, the requested CS change is because the new rule regarding namespacing constants has been deployed in fabbot, but the new version of the fixer has not yet been applied on the project code.

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Feb 11, 2021

How does this play with flex when it needs to add entries to .env files?
I suppose you patched your public/index.php and bin/console files accordingly?
A better option might provided by symfony/symfony#38465, which manages an "extra.runtime.dotenv_path" for this.

@dsech
Copy link
Author

dsech commented Feb 11, 2021

Indeed, I've manually changed the .env filename in public/index.php, bin/console, and .gitignore, but then I got stuck because I couldn't tell dump-env to dump the new .env files for production.

This approach definitely breaks flex by writing to the wrong .env file. But it's not a blocking issue, as I can always copy the generated lines and move them in the correct place.

And, of course, if the new symfony/runtime component allows configuring the .env filename everywhere (including the dump env command), then it's definitely a nicer approach than what I'm trying to do here.

Should I close this PR?

@dsech dsech closed this Apr 5, 2021
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.

3 participants