commit f627f65bfad293a521e8dfa57113fba2fde6206d parent e599261cf27bf7014a18cfb3ac7dcecdde7227b6 Author: Jan Dankert <develop@jandankert.de> Date: Thu, 7 Oct 2021 23:54:09 +0200 New: Location of config file is able to be overwritten by environment. Diffstat:
M | modules/cms/Dispatcher.class.php | | | 12 | ++++++++---- |
M | modules/cms/base/Startup.class.php | | | 1 | + |
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/modules/cms/Dispatcher.class.php b/modules/cms/Dispatcher.class.php @@ -216,10 +216,14 @@ class Dispatcher { $conf = Session::getConfig(); - // Konfiguration lesen. - // Wenn Konfiguration noch nicht in Session vorhanden oder die Konfiguration geändert wurde (erkennbar anhand des Datei-Datums) - // dann die Konfiguration neu einlesen. - $configLoader = new ConfigurationLoader(__DIR__ . '/../../config/config.yml'); + $configFile = getenv( 'CMS_CONFIG_FILE' ); + if ( ! $configFile ) + $configFile = Startup::DEFAULT_CONFIG_FILE; + + // Konfiguration lesen. + // Wenn Konfiguration noch nicht in Session vorhanden oder die Konfiguration geändert wurde (erkennbar anhand des Datei-Datums) + // dann die Konfiguration neu einlesen. + $configLoader = new ConfigurationLoader( $configFile ); if (!is_array($conf) || @$conf['config']['auto_reload'] && $configLoader->lastModificationTime() > @$conf['config']['last_modification_time']) { diff --git a/modules/cms/base/Startup.class.php b/modules/cms/base/Startup.class.php @@ -35,6 +35,7 @@ class Startup { const HTML_MODULES_DIR = './modules/'; const THEMES_DIR = './modules/cms/ui/themes/'; const CSS_PREFIX = 'or-'; + const DEFAULT_CONFIG_FILE = __DIR__ . '/../../../config/config.yml'; /** * This is the application name.