-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Labels
BugDotenvHelp wantedIssues and PRs which are looking for volunteers to complete them.Issues and PRs which are looking for volunteers to complete them.
Description
Description
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',
);
But when I put my variable TEST
before the APP_ENV
like this:
# .env file
TEST=foo_${APP_ENV}
###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=2eb810c79fba0dd5c029a2fa53bfdb51
###< symfony/framework-bundle ###
And I run composer dump-env prod
again, the value of TEST
is correct
// .env.locale.php
return array (
'APP_ENV' => 'prod',
'TEST' => 'foo_prod',
'APP_SECRET' => '2eb810c79fba0dd5c029a2fa53bfdb51',
);
How can we explain that ?
How to reproduce
- Create a new Symfony project
composer create-project symfony/skeleton bug_app
- Add new variable
TEST
in your.env
- Run
composer dump-env prod
- Take a look at
.env.locale.php
- In your
.env
file, put yourTEST
variable before theAPP_ENV
- Then run
composer dump-env prod
again - Take a look at
.env.locale.php
again
Kocal
Metadata
Metadata
Assignees
Labels
BugDotenvHelp wantedIssues and PRs which are looking for volunteers to complete them.Issues and PRs which are looking for volunteers to complete them.