31 lines
1.0 KiB
PHP
31 lines
1.0 KiB
PHP
<?php
|
|
|
|
use CameraBundle\Kernel;
|
|
use Symfony\Component\Debug\Debug;
|
|
use Symfony\Component\Dotenv\Dotenv;
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
|
|
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())->load(__DIR__.'/../.env');
|
|
}
|
|
|
|
if ($_SERVER['APP_DEBUG'] ?? ('prod' !== ($_SERVER['APP_ENV'] ?? 'dev'))) {
|
|
umask(0000);
|
|
|
|
Debug::enable();
|
|
}
|
|
|
|
// Request::setTrustedProxies(['0.0.0.0/0'], Request::HEADER_FORWARDED);
|
|
|
|
$kernel = new Kernel($_SERVER['APP_ENV'] ?? 'dev', $_SERVER['APP_DEBUG'] ?? ('prod' !== ($_SERVER['APP_ENV'] ?? 'dev')));
|
|
$request = Request::createFromGlobals();
|
|
$response = $kernel->handle($request);
|
|
$response->send();
|
|
$kernel->terminate($request, $response);
|