1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-07-03 16:24:50 +02:00

fix: case-insensitive config from env, fix #2935 (#2973)

* refactor

* fix: case-sensitive config from env, fix #2935

* lowercase all config section and keys

* test: add test for case-insensitivity
This commit is contained in:
Dag
2022-08-23 21:19:53 +02:00
committed by GitHub
parent edbafc6144
commit 5165ea265d
10 changed files with 78 additions and 161 deletions

View File

@ -20,22 +20,22 @@ class MemcachedCache implements CacheInterface
$port = Configuration::getConfig($section, 'port');
if (empty($host) && empty($port)) {
throw new \Exception('Configuration for ' . $section . ' missing. Please check your ' . FILE_CONFIG);
throw new \Exception('Configuration for ' . $section . ' missing.');
}
if (empty($host)) {
throw new \Exception('"host" param is not set for ' . $section . '. Please check your ' . FILE_CONFIG);
throw new \Exception('"host" param is not set for ' . $section);
}
if (empty($port)) {
throw new \Exception('"port" param is not set for ' . $section . '. Please check your ' . FILE_CONFIG);
throw new \Exception('"port" param is not set for ' . $section);
}
if (!ctype_digit($port)) {
throw new \Exception('"port" param is invalid for ' . $section . '. Please check your ' . FILE_CONFIG);
throw new \Exception('"port" param is invalid for ' . $section);
}
$port = intval($port);
if ($port < 1 || $port > 65535) {
throw new \Exception('"port" param is invalid for ' . $section . '. Please check your ' . FILE_CONFIG);
throw new \Exception('"port" param is invalid for ' . $section);
}
$conn = new \Memcached();