From d90a9880db6cf1e8a396713123cd6f0225cb3b92 Mon Sep 17 00:00:00 2001 From: Norbert Wagner Date: Thu, 1 Jul 2021 22:48:41 +0200 Subject: [PATCH] make modes configurable in default.conf.php relates #5453 --- src/Settings.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Settings.php b/src/Settings.php index c1cd56a..be1c780 100644 --- a/src/Settings.php +++ b/src/Settings.php @@ -142,6 +142,10 @@ class Settings implements \Iterator throw new \Exception( "No settingsfile: $defaultConf" ); // throw new FileNotFoundException(); } + + if (isset($this->settings['modes'])) { + $this->addModes($this->settings['modes']); + } // load local config without merging - we need it here for the mode $conf = $this->buildFileName(); @@ -167,9 +171,9 @@ class Settings implements \Iterator } // load and merge Prefix.mode.conf.php - if ( isset( $modes[ $this->mode ] ) ) + if ( isset( $this->modes[ $this->mode ] ) ) { - $modeConf = $this->buildFileName( $modes[ $this->mode ] ); + $modeConf = $this->buildFileName( $this->modes[ $this->mode ] ); if ( file_exists($modeConf) ) { @@ -183,6 +187,7 @@ class Settings implements \Iterator else { // log invalid mode + throw new \Exception( "The mode '{$this->mode}' is not valid" ); } // merge Prefix.conf.php (localConf)