25 lines
639 B
PHP
25 lines
639 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* Base database for Nexus core (users, settings, modules).
|
|
* Prefer the deployed root config, but fall back to checked-in env defaults.
|
|
*/
|
|
|
|
$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;
|
|
}
|
|
}
|
|
|
|
throw new RuntimeException(
|
|
'Missing base DB config. Expected one of: '
|
|
. implode(', ', array_map(static fn (string $path): string => basename(dirname($path)) . '/' . basename($path), $candidates))
|
|
);
|