diff --git a/bootstrap/app.php b/bootstrap/app.php index 466f40c..c656976 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -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; diff --git a/cli.php b/cli.php index 4e9ec1b..b1c8d4b 100644 --- a/cli.php +++ b/cli.php @@ -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;