Dont use getenv(), use $_SERVER instead

This commit is contained in:
Nicolas Grekas
2017-08-22 15:09:35 +02:00
parent 9dd224dd68
commit ca22a33dca
3 changed files with 7 additions and 7 deletions
@@ -8,11 +8,11 @@ use Symfony\Component\HttpFoundation\Request;
require __DIR__.'/../vendor/autoload.php';
// The check is to ensure we don't use .env in production
if (!getenv('APP_ENV')) {
if (!isset($_SERVER['APP_ENV'])) {
(new Dotenv())->load(__DIR__.'/../.env');
}
if (getenv('APP_DEBUG')) {
if ($_SERVER['APP_DEBUG'] ?? true) {
// WARNING: You should setup permissions the proper way!
// REMOVE the following PHP line and read
// https://symfony.com/doc/current/book/installation.html#checking-symfony-application-configuration-and-setup
@@ -23,7 +23,7 @@ if (getenv('APP_DEBUG')) {
// Request::setTrustedProxies(['0.0.0.0/0'], Request::HEADER_FORWARDED);
$kernel = new Kernel(getenv('APP_ENV'), getenv('APP_DEBUG'));
$kernel = new Kernel($_SERVER['APP_ENV'] ?? 'dev', $_SERVER['APP_DEBUG'] ?? true);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();