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

Use ->loadEnv() instead of ->load() to support the 'standard' Symfony… #1974

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ appveyor.yml
/config/routes/local
!/config/routes/local/_import_dev.yaml
.php-version
/.env.local
/.env.*.local

###> symfony/framework-bundle ###
/public/bundles/
Expand Down
2 changes: 1 addition & 1 deletion bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (!isset($_SERVER['APP_ENV'])) {
if (!class_exists(Dotenv::class)) {
throw new \RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.');
}
(new Dotenv())->load(__DIR__.'/../.env');
(new Dotenv())->bootEnv(__DIR__.'/../.env');
}

$input = new ArgvInput();
Expand Down
4 changes: 2 additions & 2 deletions public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

require __DIR__.'/../vendor/autoload.php';

// The check is to ensure we don't use .env in production
// If APP_ENV is set Dotenv is skipped (so .env / .env.local etc. are _not_ processed)
if (! isset($_SERVER['APP_ENV'])) {
if (! class_exists(Dotenv::class)) {
throw new \RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.');
}
(new Dotenv())->load(__DIR__.'/../.env');
(new Dotenv())->bootEnv(__DIR__.'/../.env');
}

$env = $_SERVER['APP_ENV'] ?? 'dev';
Expand Down