-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Dotenv] search variable values in ENV first then env file #32943
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
Merged
nicolas-grekas
merged 1 commit into
symfony:3.4
from
soufianZantar:dotenv/fix-variable-values-in-command
Oct 11, 2019
Merged
[Dotenv] search variable values in ENV first then env file #32943
nicolas-grekas
merged 1 commit into
symfony:3.4
from
soufianZantar:dotenv/fix-variable-values-in-command
Oct 11, 2019
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a4b0dfc
to
d83374d
Compare
Kocal
reviewed
Aug 5, 2019
bafde61
to
79561a7
Compare
nicolas-grekas
approved these changes
Oct 8, 2019
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.
(failures unrelated)
79561a7
to
cd0e9ef
Compare
cd0e9ef
to
3018041
Compare
Thank you @soufianZantar. |
nicolas-grekas
added a commit
that referenced
this pull request
Oct 11, 2019
… (soufianZantar) This PR was merged into the 3.4 branch. Discussion ---------- [Dotenv] search variable values in ENV first then env file | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #32595 | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> <!-- Replace this notice by a short README for your feature/bugfix. This will help people understand your PR and can be used as a start for the documentation. Additionally (see https://symfony.com/roadmap): - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against branch 4.4. - Legacy code removals go to the master branch. --> I think we must searhing the value of variables in $_ENV before the .env file to fix this issues. before this fix Parse method will return the value in .env file and not the value passed in this command `composer dump-env prod `. **the issue:** In my .env file, I have a variable TEST that depends on the APP_ENV variable like this: ``` # .env file ###> symfony/framework-bundle ### APP_ENV=dev APP_SECRET=2eb810c79fba0dd5c029a2fa53bfdb51 ###< symfony/framework-bundle ### TEST=foo_${APP_ENV} ``` I run composer dump-env dev command to generate my .env.locale.php, everything works fine, the value of my variable TEST is correct. ``` // .env.locale.php return array ( 'APP_ENV' => 'dev', 'TEST' => 'foo_dev', 'APP_SECRET' => '2eb810c79fba0dd5c029a2fa53bfdb51', ); ``` Then I run the same command with prod environment (composer dump-env prod), the value of TEST is wrong (it is same as for dev) ``` // .env.locale.php return array ( 'APP_ENV' => 'prod', 'TEST' => 'foo_dev', 'APP_SECRET' => '2eb810c79fba0dd5c029a2fa53bfdb51', ); ``` Commits ------- 3018041 [Dotenv] search variable values in ENV first then env file
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I think we must searhing the value of variables in $_ENV before the .env file to fix this issues.
before this fix Parse method will return the value in .env file and not the value passed in this command
composer dump-env prod
.the issue:
In my .env file, I have a variable TEST that depends on the APP_ENV variable like this:
I run composer dump-env dev command to generate my .env.locale.php, everything works fine, the value of my variable TEST is correct.
Then I run the same command with prod environment (composer dump-env prod), the value of TEST is wrong (it is same as for dev)