remove usage of getenv from codebase (#1861)

This commit is contained in:
Kevin Papst
2020-08-02 01:02:04 +02:00
committed by GitHub
parent 6f8c0e3cb6
commit 476e6ca150
14 changed files with 122 additions and 123 deletions

View File

@@ -5,12 +5,10 @@ use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\HttpFoundation\Request;
require __DIR__.'/../vendor/autoload.php';
require dirname(__DIR__) . '/vendor/autoload.php';
// The check is to ensure we don't use .env in production
if (!isset($_SERVER['APP_ENV'])) {
(new Dotenv(true))->load(__DIR__.'/../.env');
}
// do NOT rely on calls to getenv() as it is not thread safe
(new Dotenv(false))->loadEnv(dirname(__DIR__) . '/.env');
$env = $_SERVER['APP_ENV'] ?? 'prod';
$debug = (bool) ($_SERVER['APP_DEBUG'] ?? (in_array($env, ['dev', 'test'])));