refactor(config): remove runtime config files and centralize route/bootstrap

This commit is contained in:
2026-04-01 20:27:42 +02:00
parent dba589b495
commit 5699bc6c5b
20 changed files with 487 additions and 118 deletions

View File

@@ -64,31 +64,6 @@ if (!defined('APP_LOCALES')) {
define('APP_LOCALES', $envList('APP_LOCALES', ['de', 'en']));
}
if (!defined('APP_ROUTE_DEFINITIONS')) {
$routesFile = __DIR__ . '/routes.php';
$routeDefinitions = is_file($routesFile) ? include $routesFile : [];
if (!is_array($routeDefinitions)) {
$routeDefinitions = [];
}
define('APP_ROUTE_DEFINITIONS', $routeDefinitions);
}
if (!defined('APP_PUBLIC_PATHS')) {
$publicPaths = [];
foreach (APP_ROUTE_DEFINITIONS as $route) {
if (!empty($route['public'])) {
$path = trim((string) ($route['path'] ?? ''));
if ($path !== '') {
$publicPaths[] = $path;
}
}
}
if (!$publicPaths) {
throw new RuntimeException('No public routes configured in config/routes.php');
}
define('APP_PUBLIC_PATHS', array_values(array_unique($publicPaths)));
}
date_default_timezone_set(APP_TIMEZONE);
Router::$baseUrl = '/'; // default: '/'