From 112a6f99424dcae6b3a738bcf09ae180ccae80af Mon Sep 17 00:00:00 2001 From: Molkobain Date: Thu, 20 Jun 2024 17:09:50 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B07588=20-=20Fix=20.env.local=20not=20work?= =?UTF-8?q?ing=20for=20the=20portal=20since=20Symfony=205.4=20migration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2.x/itop-portal-base/portal/config/bootstrap.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/datamodels/2.x/itop-portal-base/portal/config/bootstrap.php b/datamodels/2.x/itop-portal-base/portal/config/bootstrap.php index 5969abe39..bb1abef1a 100644 --- a/datamodels/2.x/itop-portal-base/portal/config/bootstrap.php +++ b/datamodels/2.x/itop-portal-base/portal/config/bootstrap.php @@ -41,16 +41,11 @@ if (!defined('MODULESROOT')) require_once APPROOT.'/application/startup.inc.php'; } -// Load cached env vars if the .env.local.php file exists -// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2) -if (file_exists(dirname(__DIR__).'/.env.local.php')) { - if (is_array($sEnv = @include dirname(__DIR__).'/.env.local.php')) { - $_ENV += $sEnv; - } -} elseif (!class_exists(Dotenv::class)) { +// Load cached env vars if the .env.local file exists +if (!class_exists(Dotenv::class)) { throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.'); } else { - $sPath = dirname(__DIR__).'/.env'; + $sPath = file_exists(dirname(__DIR__).'/.env.local') ? dirname(__DIR__).'/.env.local' : dirname(__DIR__).'/.env'; $oDotenv = new Dotenv(); $oDotenv->usePutenv();