2018-01-12 19:39:07 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use App\Kernel;
|
2020-02-04 14:29:26 +00:00
|
|
|
use Symfony\Component\ErrorHandler\Debug;
|
2018-01-12 19:39:07 +00:00
|
|
|
use Symfony\Component\Dotenv\Dotenv;
|
|
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
|
|
|
2020-08-01 23:02:04 +00:00
|
|
|
require dirname(__DIR__) . '/vendor/autoload.php';
|
2018-01-12 19:39:07 +00:00
|
|
|
|
2020-08-01 23:02:04 +00:00
|
|
|
// do NOT rely on calls to getenv() as it is not thread safe
|
|
|
|
(new Dotenv(false))->loadEnv(dirname(__DIR__) . '/.env');
|
2018-01-12 19:39:07 +00:00
|
|
|
|
2019-10-14 10:30:11 +00:00
|
|
|
$env = $_SERVER['APP_ENV'] ?? 'prod';
|
2020-06-10 23:26:57 +00:00
|
|
|
$debug = (bool) ($_SERVER['APP_DEBUG'] ?? (in_array($env, ['dev', 'test'])));
|
2018-01-12 19:39:07 +00:00
|
|
|
|
|
|
|
if ($debug) {
|
|
|
|
umask(0000);
|
|
|
|
|
|
|
|
Debug::enable();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
|
|
|
|
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
|
|
|
|
Request::setTrustedHosts(explode(',', $trustedHosts));
|
|
|
|
}
|
|
|
|
|
|
|
|
$kernel = new Kernel($env, $debug);
|
|
|
|
$request = Request::createFromGlobals();
|
|
|
|
$response = $kernel->handle($request);
|
|
|
|
$response->send();
|
|
|
|
$kernel->terminate($request, $response);
|