Update bootstrap and cli env loaders to support /home/scout/.env

This commit is contained in:
Hamza-Ayed
2026-06-05 01:29:26 +03:00
parent bed7624ae9
commit 68c62c71ed
2 changed files with 14 additions and 2 deletions

View File

@@ -3,9 +3,15 @@
require_once __DIR__ . '/../vendor/autoload.php';
// Bootstrap Environment configurations
if (file_exists(__DIR__ . '/../.env')) {
$localEnv = __DIR__ . '/../.env';
$parentEnv = __DIR__ . '/../../..';
if (file_exists($localEnv)) {
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . '/..');
$dotenv->load();
} elseif (file_exists($parentEnv . '/.env')) {
$dotenv = Dotenv\Dotenv::createImmutable($parentEnv);
$dotenv->load();
}
use App\Core\Container;

View File

@@ -7,9 +7,15 @@ if (php_sapi_name() !== 'cli') {
require __DIR__ . '/vendor/autoload.php';
// Bootstrap Environment configurations
if (file_exists(__DIR__ . '/.env')) {
$localEnv = __DIR__ . '/.env';
$parentEnv = __DIR__ . '/../..';
if (file_exists($localEnv)) {
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();
} elseif (file_exists($parentEnv . '/.env')) {
$dotenv = Dotenv\Dotenv::createImmutable($parentEnv);
$dotenv->load();
}
use App\Core\Container;