|
@@ -3,39 +3,23 @@
|
|
|
|
|
|
use Chamilo\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');
|
|
|
-}
|
|
|
-
|
|
|
-$env = $_SERVER['APP_ENV'] ?? 'dev';
|
|
|
-$debug = $_SERVER['APP_DEBUG'] ?? ('prod' !== $env);
|
|
|
-
|
|
|
-if ($debug) {
|
|
|
+require dirname(__DIR__).'/config/bootstrap.php';
|
|
|
+if ($_SERVER['APP_DEBUG']) {
|
|
|
umask(0000);
|
|
|
-
|
|
|
Debug::enable();
|
|
|
}
|
|
|
-
|
|
|
-if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
|
|
|
+if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['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));
|
|
|
+if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) {
|
|
|
+ Request::setTrustedHosts([$trustedHosts]);
|
|
|
}
|
|
|
|
|
|
require_once __DIR__.'/legacy.php';
|
|
|
|
|
|
-$kernel = new Kernel($env, $debug);
|
|
|
+$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
|
|
|
//$request = Request::createFromGlobals();
|
|
|
$request = Sonata\PageBundle\Request\RequestFactory::createFromGlobals(
|
|
|
'host_with_path_by_locale'
|