commit changes
This commit is contained in:
@@ -3,28 +3,12 @@ declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Base database for Nexus core (users, settings, modules).
|
||||
* This uses the environment-specific config in /config/{env}/db_settings_basic.php.
|
||||
* Sync copies the correct file into /config.
|
||||
*/
|
||||
|
||||
$env = getenv('APP_ENV');
|
||||
if (!$env && defined('APP_ENV')) {
|
||||
$env = APP_ENV;
|
||||
}
|
||||
if (!$env) {
|
||||
$env = 'prod';
|
||||
$path = __DIR__ . '/db_settings_basic.php';
|
||||
if (!file_exists($path)) {
|
||||
throw new RuntimeException('Missing base DB config: expected config/db_settings_basic.php');
|
||||
}
|
||||
|
||||
$env = strtolower((string)$env);
|
||||
$candidates = [
|
||||
__DIR__ . '/' . $env . '/db_settings_basic.php',
|
||||
__DIR__ . '/staging/db_settings_basic.php',
|
||||
__DIR__ . '/prod/db_settings_basic.php',
|
||||
];
|
||||
|
||||
foreach ($candidates as $path) {
|
||||
if (file_exists($path)) {
|
||||
return require $path;
|
||||
}
|
||||
}
|
||||
|
||||
throw new RuntimeException('Missing base DB config: expected config/{env}/db_settings_basic.php');
|
||||
return require $path;
|
||||
|
||||
Reference in New Issue
Block a user