From a92bad1bc898cd02be3434f7a44bdb366a8aab2c Mon Sep 17 00:00:00 2001 From: "J. King" Date: Mon, 18 Jun 2018 10:09:43 -0400 Subject: [PATCH] Correctly load configuration --- arsse.php | 6 ++---- lib/CLI.php | 7 ++----- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/arsse.php b/arsse.php index 2c2039fd..8214bb22 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 b468dda6..2cf84cdf 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;