Browse Source

Correctly load configuration

microsub
J. King 6 years ago
parent
commit
a92bad1bc8
  1. 6
      arsse.php
  2. 7
      lib/CLI.php

6
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();

7
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;

Loading…
Cancel
Save