openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 619b3b27be3adbb327147b69561b909c5ddb53f1
parent 74fd9732b39718e5318ba9e24befee33d82ff989
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:
Mmodules/cms/Dispatcher.class.php | 12++++++++----
Mmodules/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.