improve configurations for usage in multi-environment setups (#1775)

This commit is contained in:
Kevin Papst
2020-06-11 01:26:57 +02:00
committed by GitHub
parent 57b4473bc8
commit 21d8e8bbb8
17 changed files with 66 additions and 65 deletions

View File

@@ -9,14 +9,11 @@ require __DIR__.'/../vendor/autoload.php';
// The check is to ensure we don't use .env in production
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(true))->load(__DIR__.'/../.env');
}
$env = $_SERVER['APP_ENV'] ?? 'prod';
$debug = $_SERVER['APP_DEBUG'] ?? ('prod' !== $env);
$debug = (bool) ($_SERVER['APP_DEBUG'] ?? (in_array($env, ['dev', 'test'])));
if ($debug) {
umask(0000);