diff --git a/arsse.php b/arsse.php index 2c2039f..8214bb2 100644 --- a/arsse.php +++ b/arsse.php @@ -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(); diff --git a/lib/CLI.php b/lib/CLI.php index b468dda..2cf84cd 100644 --- a/lib/CLI.php +++ b/lib/CLI.php @@ -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;