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:
41
public/bootstrap.php
Normal file
41
public/bootstrap.php
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user