| @@ 6-11 (lines=6) @@ | ||
| 3 | use Symfony\Component\Dotenv\Dotenv; |
|
| 4 | ||
| 5 | // The check is to ensure we don't use .env in production |
|
| 6 | if (!isset($_SERVER['APP_ENV'])) { |
|
| 7 | if (!class_exists(Dotenv::class)) { |
|
| 8 | 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.'); |
|
| 9 | } |
|
| 10 | (new Dotenv())->load(__DIR__.'/../../.env'); |
|
| 11 | } |
|
| 12 | ||
| @@ 13-18 (lines=6) @@ | ||
| 10 | require __DIR__.'/../vendor/autoload.php'; |
|
| 11 | ||
| 12 | // The check is to ensure we don't use .env in production |
|
| 13 | if (!isset($_SERVER['APP_ENV'])) { |
|
| 14 | if (!class_exists(Dotenv::class)) { |
|
| 15 | 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.'); |
|
| 16 | } |
|
| 17 | (new Dotenv())->load(__DIR__.'/../.env'); |
|
| 18 | } |
|
| 19 | ||
| 20 | $env = $_SERVER['APP_ENV'] ?? 'dev'; |
|
| 21 | $debug = $_SERVER['APP_DEBUG'] ?? ('prod' !== $env); |
|