update
This commit is contained in:
@@ -6,20 +6,14 @@ ini_set('display_errors', '1');
|
||||
ini_set('display_startup_errors', '1');
|
||||
error_reporting(E_ALL);
|
||||
|
||||
// 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 (['domaindata.php','settings.php'] as $cfgFile) {
|
||||
// Required config files live in /config (sync copies staging/prod here)
|
||||
foreach (['domaindata.php', 'settings.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)");
|
||||
throw new \RuntimeException("Missing required config file: $cfgFile (expected $rootPath)");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user