jeboehm /
mailserver-admin
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | /** |
||
| 5 | * This file is part of the mailserver-admin package. |
||
| 6 | * (c) Jeffrey Boehm <https://github.com/jeboehm/mailserver-admin> |
||
| 7 | * For the full copyright and license information, please view the LICENSE |
||
| 8 | * file that was distributed with this source code. |
||
| 9 | */ |
||
| 10 | |||
| 11 | use App\Kernel; |
||
| 12 | use Symfony\Component\Dotenv\Dotenv; |
||
| 13 | use Symfony\Component\ErrorHandler\Debug; |
||
| 14 | use Symfony\Component\HttpFoundation\Request; |
||
| 15 | |||
| 16 | require __DIR__ . '/../vendor/autoload.php'; |
||
| 17 | |||
| 18 | // The check is to ensure we don't use .env in production |
||
| 19 | if (!isset($_SERVER['APP_ENV'])) { |
||
| 20 | if (!class_exists(Dotenv::class)) { |
||
| 21 | 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.'); |
||
| 22 | } |
||
| 23 | (new Dotenv())->load(__DIR__ . '/../.env'); |
||
| 24 | } |
||
| 25 | |||
| 26 | $env = $_SERVER['APP_ENV'] ?? 'dev'; |
||
| 27 | $debug = (bool) ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env)); |
||
| 28 | |||
| 29 | if ($debug) { |
||
| 30 | umask(0000); |
||
| 31 | |||
| 32 | Debug::enable(); |
||
| 33 | } |
||
| 34 | |||
| 35 | if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) { |
||
| 36 | Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST); |
||
|
0 ignored issues
–
show
|
|||
| 37 | } |
||
| 38 | |||
| 39 | if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) { |
||
| 40 | Request::setTrustedHosts(explode(',', $trustedHosts)); |
||
| 41 | } |
||
| 42 | |||
| 43 | $kernel = new Kernel($env, $debug); |
||
| 44 | $request = Request::createFromGlobals(); |
||
| 45 | $response = $kernel->handle($request); |
||
| 46 | $response->send(); |
||
| 47 | $kernel->terminate($request, $response); |
||
| 48 |
This class constant has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the constant will be removed from the class and what other constant to use instead.