This commit is contained in:
2025-12-21 01:21:53 +01:00
parent a97f4f77ba
commit 4b20dbd472
4 changed files with 22 additions and 5 deletions

View File

@@ -6,8 +6,22 @@ ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
require_once __DIR__ . '/settings.php';
require_once __DIR__ . '/domaindata.php';
// Pick config set: first try root files, otherwise fall back to env dir (prod/staging/...)
$appEnvFromEnv = getenv('APP_ENV') ?: 'prod';
$envDir = rtrim(__DIR__, '/\\') . '/' . $appEnvFromEnv;
foreach (['settings.php', 'domaindata.php'] as $cfgFile) {
$rootPath = __DIR__ . '/' . $cfgFile;
$envPath = $envDir . '/' . $cfgFile;
if (file_exists($rootPath)) {
require_once $rootPath;
} elseif (file_exists($envPath)) {
require_once $envPath;
} else {
throw new \RuntimeException("Missing required config file: $cfgFile (looked for $rootPath or $envPath)");
}
}
// Environment: staging|prod|local (example)