Deploy: 2026-05-21 00:47:51

This commit is contained in:
Hamza-Ayed
2026-05-21 00:47:51 +03:00
parent 8e429d8313
commit 146ebd7200
2 changed files with 15 additions and 27 deletions

View File

@@ -29,7 +29,16 @@ spl_autoload_register(function ($class) {
// 2. Load Environment Variables
try {
\App\Core\Env::load(APP_ROOT . '/.env');
// Find the closest .env file path (supporting local development and CloudPanel server directories)
$env_file = APP_ROOT . '/.env';
if (!file_exists($env_file)) {
if (file_exists(APP_ROOT . '/../../../.env')) {
$env_file = APP_ROOT . '/../../../.env';
} elseif (file_exists(APP_ROOT . '/../.env')) {
$env_file = APP_ROOT . '/../.env';
}
}
\App\Core\Env::load($env_file);
} catch (\Exception $e) {
// In production, log error; in development, print it
error_log('Env Load Error: ' . $e->getMessage());