1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 13:12:41 +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();
} else {
// load configuration
Arsse::load(new Conf());
if (file_exists(BASE."config.php")) {
Arsse::$conf->importFile(BASE."config.php");
}
$conf = file_exists(BASE."config.php") ? new Conf(BASE."config.php") : new Conf;
Arsse::load($conf);
// handle Web requests
$emitter = new \Zend\Diactoros\Response\SapiEmitter();
$response = (new REST)->dispatch();

View file

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