Deploy: 2026-05-21 00:47:51
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user