1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 21:22:40 +00:00

Correctly load configuration

This commit is contained in:
J. King 2018-06-18 10:09:43 -04:00
parent 924543d78a
commit a92bad1bc8
2 changed files with 4 additions and 9 deletions

View file

@ -21,10 +21,8 @@ if (\PHP_SAPI=="cli") {
$cli->dispatch(); $cli->dispatch();
} else { } else {
// load configuration // load configuration
Arsse::load(new Conf()); $conf = file_exists(BASE."config.php") ? new Conf(BASE."config.php") : new Conf;
if (file_exists(BASE."config.php")) { Arsse::load($conf);
Arsse::$conf->importFile(BASE."config.php");
}
// handle Web requests // handle Web requests
$emitter = new \Zend\Diactoros\Response\SapiEmitter(); $emitter = new \Zend\Diactoros\Response\SapiEmitter();
$response = (new REST)->dispatch(); $response = (new REST)->dispatch();

View file

@ -36,11 +36,8 @@ USAGE_TEXT;
} }
protected function loadConf(): bool { protected function loadConf(): bool {
// FIXME: this should be a method of the Conf class $conf = file_exists(BASE."config.php") ? new Conf(BASE."config.php") : new Conf;
Arsse::load(new Conf()); Arsse::load($conf);
if (file_exists(BASE."config.php")) {
Arsse::$conf->importFile(BASE."config.php");
}
// command-line operations will never respect authorization // command-line operations will never respect authorization
Arsse::$user->authorizationEnabled(false); Arsse::$user->authorizationEnabled(false);
return true; return true;