Refactor configuration loading: Updated multiple public PHP files to require a new bootstrap file for configuration management. Adjusted paths for product configuration to enhance maintainability and consistency across the application.

This commit is contained in:
smueller
2026-05-22 13:58:30 +02:00
parent ec8686761c
commit 96a5977283
19 changed files with 151 additions and 31 deletions

41
public/bootstrap.php Normal file
View File

@@ -0,0 +1,41 @@
<?php
/**
* HexaHost Bootstrap für Monorepo- und Produktions-Layout
*
* Monorepo: public/../backend/{includes,config}
* Produktion: public/{includes,config} (nach Backend-Kopie)
*/
if (!defined('HEXAHOST_BOOTSTRAPPED')) {
$pathCandidates = [
[
'includes' => __DIR__ . '/includes',
'config' => __DIR__ . '/config',
],
[
'includes' => __DIR__ . '/../backend/includes',
'config' => __DIR__ . '/../backend/config',
],
];
$resolved = false;
foreach ($pathCandidates as $paths) {
if (is_file($paths['includes'] . '/functions.php')) {
define('HEXAHOST_INCLUDES_DIR', $paths['includes']);
define('HEXAHOST_CONFIG_DIR', $paths['config']);
require_once $paths['includes'] . '/functions.php';
$resolved = true;
break;
}
}
if (!$resolved) {
http_response_code(500);
header('Content-Type: text/plain; charset=utf-8');
echo 'HexaHost: Anwendung konnte nicht gestartet werden (includes nicht gefunden).';
exit;
}
define('HEXAHOST_BOOTSTRAPPED', true);
}