Working state
This commit is contained in:
@@ -11,6 +11,7 @@ use App\Shared\Extension\CsrfExtension;
|
||||
use App\Shared\Extension\SessionExtension;
|
||||
use DI\ContainerBuilder;
|
||||
use Dotenv\Dotenv;
|
||||
use Dotenv\Exception\InvalidPathException;
|
||||
use PDO;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
@@ -124,8 +125,22 @@ final class Bootstrap
|
||||
|
||||
private function loadEnvironment(): void
|
||||
{
|
||||
$dotenv = Dotenv::createImmutable(__DIR__.'/../..');
|
||||
$dotenv->load();
|
||||
$rootDir = dirname(__DIR__, 2);
|
||||
$envPath = $rootDir . '/.env';
|
||||
|
||||
try {
|
||||
$dotenv = Dotenv::createImmutable($rootDir);
|
||||
$dotenv->load();
|
||||
} catch (InvalidPathException $exception) {
|
||||
throw new \RuntimeException(
|
||||
sprintf(
|
||||
"Fichier .env introuvable a la racine du projet (%s). Copiez .env.example vers .env avant de demarrer l'application.",
|
||||
$envPath
|
||||
),
|
||||
previous: $exception,
|
||||
);
|
||||
}
|
||||
|
||||
$dotenv->required(['APP_URL', 'ADMIN_USERNAME', 'ADMIN_EMAIL', 'ADMIN_PASSWORD']);
|
||||
|
||||
date_default_timezone_set($_ENV['TIMEZONE'] ?? 'UTC');
|
||||
|
||||
Reference in New Issue
Block a user