1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-06 00:27:27 +02:00
This commit is contained in:
Dag
2023-09-20 02:45:48 +02:00
committed by GitHub
parent cf7e3eea56
commit e6aef73a02
15 changed files with 134 additions and 384 deletions

View File

@@ -15,6 +15,9 @@ final class RssBridge
}
Configuration::loadConfiguration($customConfig, getenv());
// Consider: ini_set('error_reporting', E_ALL & ~E_DEPRECATED);
date_default_timezone_set(Configuration::getConfig('system', 'timezone'));
set_exception_handler(function (\Throwable $e) {
Logger::error('Uncaught Exception', ['e' => $e]);
http_response_code(500);
@@ -57,9 +60,6 @@ final class RssBridge
}
});
// Consider: ini_set('error_reporting', E_ALL & ~E_DEPRECATED);
date_default_timezone_set(Configuration::getConfig('system', 'timezone'));
self::$httpClient = new CurlHttpClient();
$cacheFactory = new CacheFactory();
@@ -68,11 +68,6 @@ final class RssBridge
} else {
self::$cache = $cacheFactory->create();
}
if (Configuration::getConfig('authentication', 'enable')) {
$authenticationMiddleware = new AuthenticationMiddleware();
$authenticationMiddleware();
}
}
public function main(array $argv = []): void
@@ -81,6 +76,10 @@ final class RssBridge
parse_str(implode('&', array_slice($argv, 1)), $cliArgs);
$request = $cliArgs;
} else {
if (Configuration::getConfig('authentication', 'enable')) {
$authenticationMiddleware = new AuthenticationMiddleware();
$authenticationMiddleware();
}
$request = array_merge($_GET, $_POST);
}
@@ -124,10 +123,4 @@ final class RssBridge
{
return self::$cache ?? new NullCache();
}
public function clearCache()
{
$cache = self::getCache();
$cache->clear();
}
}