make modes configurable in default.conf.php

relates #5453
This commit is contained in:
norb 2021-07-01 22:48:41 +02:00
parent 9457987a31
commit d90a9880db

View file

@ -143,6 +143,10 @@ class Settings implements \Iterator
// throw new FileNotFoundException(); // 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 // load local config without merging - we need it here for the mode
$conf = $this->buildFileName(); $conf = $this->buildFileName();
$localConf = false; $localConf = false;
@ -167,9 +171,9 @@ class Settings implements \Iterator
} }
// load and merge Prefix.mode.conf.php // 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) ) if ( file_exists($modeConf) )
{ {
@ -183,6 +187,7 @@ class Settings implements \Iterator
else else
{ {
// log invalid mode // log invalid mode
throw new \Exception( "The mode '{$this->mode}' is not valid" );
} }
// merge Prefix.conf.php (localConf) // merge Prefix.conf.php (localConf)