Skip to content

Commit c8ba8f9

Browse files
authored
Only use .env.local.php in the prod environment
This prevents surprises when you have generated the file, and then run your tests.
1 parent f9c6da3 commit c8ba8f9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

symfony/framework-bundle/3.3/config/bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
// Load cached env vars if the .env.local.php file exists
88
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
9-
if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) {
9+
if ('prod' === ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? 'prod') && is_array($env = @include dirname(__DIR__).'/.env.local.php')) {
1010
foreach ($env as $k => $v) {
1111
$_ENV[$k] = $_ENV[$k] ?? (isset($_SERVER[$k]) && 0 !== strpos($k, 'HTTP_') ? $_SERVER[$k] : $v);
1212
}

0 commit comments

Comments
 (0)