Repair 2
This commit is contained in:
@@ -3,12 +3,22 @@ declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Base database for Nexus core (users, settings, modules).
|
||||
* Sync copies the correct file into /config.
|
||||
* Prefer the deployed root config, but fall back to checked-in env defaults.
|
||||
*/
|
||||
|
||||
$path = __DIR__ . '/db_settings_basic.php';
|
||||
if (!file_exists($path)) {
|
||||
throw new RuntimeException('Missing base DB config: expected config/db_settings_basic.php');
|
||||
$candidates = [
|
||||
__DIR__ . '/db_settings_basic.php',
|
||||
__DIR__ . '/staging/db_settings_basic.php',
|
||||
__DIR__ . '/prod/db_settings_basic.php',
|
||||
];
|
||||
|
||||
foreach ($candidates as $path) {
|
||||
if (is_file($path)) {
|
||||
return require $path;
|
||||
}
|
||||
}
|
||||
|
||||
return require $path;
|
||||
throw new RuntimeException(
|
||||
'Missing base DB config. Expected one of: '
|
||||
. implode(', ', array_map(static fn (string $path): string => basename(dirname($path)) . '/' . basename($path), $candidates))
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user