commit changes

This commit is contained in:
2026-03-03 02:29:04 +01:00
parent e61f9fb889
commit c982cf1b51
7 changed files with 13 additions and 33 deletions

View File

@@ -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;