This commit is contained in:
2025-12-05 01:20:55 +01:00
parent 546146ed4e
commit 7ed1dab3c5
2 changed files with 38 additions and 4 deletions

View File

@@ -1,9 +1,25 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
$bootstrapConfig = __DIR__ . '/config.php'; $bootstrapTried = false;
if (is_file($bootstrapConfig)) { $bootstrapLoaded = false;
require_once $bootstrapConfig; $bootstrapCandidates = [__DIR__ . '/config.php'];
$envHint = getenv('APP_ENV') ?: (getenv('APP_ENV_FILE') ?: null);
if ($envHint) {
$bootstrapCandidates[] = __DIR__ . '/' . $envHint . '/config.php';
}
$bootstrapCandidates[] = __DIR__ . '/staging/config.php';
$bootstrapCandidates[] = __DIR__ . '/prod/config.php';
foreach ($bootstrapCandidates as $bootstrapConfig) {
if ($bootstrapConfig && is_file($bootstrapConfig)) {
$bootstrapTried = true;
require_once $bootstrapConfig;
$bootstrapLoaded = true;
break;
}
}
if (!$bootstrapLoaded) {
throw new RuntimeException('No environment config found in config/ or its subdirectories.');
} }
$overrides = $GLOBALS['EMAILTEMPLATE_OVERRIDES'] ?? []; $overrides = $GLOBALS['EMAILTEMPLATE_OVERRIDES'] ?? [];

View File

@@ -5,7 +5,25 @@
// → Diese Datei DEFINIERT die Konstanten wie // → Diese Datei DEFINIERT die Konstanten wie
// APP_COOKIE_PREFIX, APP_COOKIE_DOMAIN, APP_ENV etc. // APP_COOKIE_PREFIX, APP_COOKIE_DOMAIN, APP_ENV etc.
// ----------------------------------------------------------- // -----------------------------------------------------------
require_once __DIR__ . "/config.php"; // Try to load primary environment bootstrap.
$bootstrapCandidates = [__DIR__ . '/config.php'];
$envHint = getenv('APP_ENV') ?: (getenv('APP_ENV_FILE') ?: null);
if ($envHint) {
$bootstrapCandidates[] = __DIR__ . '/' . $envHint . '/config.php';
}
$bootstrapCandidates[] = __DIR__ . '/staging/config.php';
$bootstrapCandidates[] = __DIR__ . '/prod/config.php';
$bootstrapLoaded = false;
foreach ($bootstrapCandidates as $bootstrap) {
if ($bootstrap && is_file($bootstrap)) {
require_once $bootstrap;
$bootstrapLoaded = true;
break;
}
}
if (!$bootstrapLoaded) {
throw new RuntimeException('No environment config found under config/.');
}
$emailtemplateConfigPath = __DIR__ . '/emailtemplate.conf.php'; $emailtemplateConfigPath = __DIR__ . '/emailtemplate.conf.php';
if (is_file($emailtemplateConfigPath)) { if (is_file($emailtemplateConfigPath)) {