-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minor #773 Updated to the latest recipe changes (javiereguiluz)
This PR was squashed before being merged into the master branch (closes #773). Discussion ---------- Updated to the latest recipe changes Commits ------- 4469293 Updated to the latest recipe changes
- Loading branch information
Showing
4 changed files
with
27 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,5 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
use App\Kernel; | ||
use Symfony\Component\Debug\Debug; | ||
use Symfony\Component\Dotenv\Dotenv; | ||
|
@@ -18,18 +9,30 @@ | |
|
||
// 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'))) { | ||
$env = $_SERVER['APP_ENV'] ?? 'dev'; | ||
$debug = (bool) ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env)); | ||
|
||
if ($debug) { | ||
umask(0000); | ||
|
||
Debug::enable(); | ||
} | ||
|
||
// Request::setTrustedProxies(['0.0.0.0/0'], Request::HEADER_FORWARDED); | ||
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($_SERVER['APP_ENV'] ?? 'dev', $_SERVER['APP_DEBUG'] ?? ('prod' !== ($_SERVER['APP_ENV'] ?? 'dev'))); | ||
$kernel = new Kernel($env, $debug); | ||
$request = Request::createFromGlobals(); | ||
$response = $kernel->handle($request); | ||
$response->send(); | ||
|