Add fallback config loading with custom overrides
This commit is contained in:
parent
ca91a18cb7
commit
f0d50ff8bf
1 changed files with 11 additions and 5 deletions
|
|
@ -1,11 +1,17 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
function createContext(): Context {
|
function createContext(): Context {
|
||||||
// Load configuration
|
// Load configuration with fallback: custom -> default
|
||||||
$configFile = file_exists(__DIR__ . '/../custom/config.ini')
|
$defaultConfig = __DIR__ . '/default/config.ini';
|
||||||
? __DIR__ . '/../custom/config.ini'
|
$customConfig = __DIR__ . '/../custom/config.ini';
|
||||||
: __DIR__ . '/config.ini';
|
|
||||||
$config = parse_ini_file($configFile, true);
|
// Start with default config
|
||||||
|
$config = file_exists($defaultConfig) ? parse_ini_file($defaultConfig, true) : [];
|
||||||
|
|
||||||
|
// Merge with custom config if it exists
|
||||||
|
if (file_exists($customConfig)) {
|
||||||
|
$config = array_replace_recursive($config, parse_ini_file($customConfig, true) ?: []);
|
||||||
|
}
|
||||||
|
|
||||||
// Load global plugins
|
// Load global plugins
|
||||||
getPluginManager()->loadGlobalPlugins($config);
|
getPluginManager()->loadGlobalPlugins($config);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue