31 lines
704 B
PHP
31 lines
704 B
PHP
<?php
|
|
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.
|
|
*/
|
|
|
|
$env = getenv('APP_ENV');
|
|
if (!$env && defined('APP_ENV')) {
|
|
$env = APP_ENV;
|
|
}
|
|
if (!$env) {
|
|
$env = 'prod';
|
|
}
|
|
|
|
$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');
|