aboutsummaryrefslogtreecommitdiff
path: root/lib/Configuration.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Configuration.php')
-rw-r--r--lib/Configuration.php42
1 files changed, 34 insertions, 8 deletions
diff --git a/lib/Configuration.php b/lib/Configuration.php
index 6eec33f6..2f677ae5 100644
--- a/lib/Configuration.php
+++ b/lib/Configuration.php
@@ -98,6 +98,25 @@ final class Configuration
self::setConfig($header, $key, $value);
}
}
+
+ if (file_exists(__DIR__ . '/../DEBUG')) {
+ // The debug mode has been moved to config. Preserve existing installs which has this DEBUG file.
+ self::setConfig('system', 'enable_debug_mode', true);
+ $debug = trim(file_get_contents(__DIR__ . '/../DEBUG'));
+ if ($debug) {
+ self::setConfig('system', 'debug_mode_whitelist', explode("\n", str_replace("\r", '', $debug)));
+ }
+ }
+
+ if (file_exists(__DIR__ . '/../whitelist.txt')) {
+ $whitelist = trim(file_get_contents(__DIR__ . '/../whitelist.txt'));
+ if ($whitelist === '*') {
+ self::setConfig('system', 'enabled_bridges', ['*']);
+ } else {
+ self::setConfig('system', 'enabled_bridges', explode("\n", $whitelist));
+ }
+ }
+
foreach ($env as $envName => $envValue) {
$nameParts = explode('_', $envName);
if ($nameParts[0] === 'RSSBRIDGE') {
@@ -105,22 +124,29 @@ final class Configuration
// Invalid env name
continue;
}
+
+ // The variable is named $header but it's actually the section in config.ini.php
$header = $nameParts[1];
- $key = $nameParts[2];
+
+ // Recombine the key if it had multiple underscores
+ $key = implode('_', array_slice($nameParts, 2));
+
+ // Handle this specifically because it's an array
+ if ($key === 'enabled_bridges') {
+ $envValue = explode(',', $envValue);
+ $envValue = array_map('trim', $envValue);
+ }
+
if ($envValue === 'true' || $envValue === 'false') {
$envValue = filter_var($envValue, FILTER_VALIDATE_BOOLEAN);
}
+
self::setConfig($header, $key, $envValue);
}
}
- if (file_exists(__DIR__ . '/../DEBUG')) {
- // The debug mode has been moved to config. Preserve existing installs which has this DEBUG file.
- self::setConfig('system', 'enable_debug_mode', true);
- $debug = trim(file_get_contents(__DIR__ . '/../DEBUG'));
- if ($debug) {
- self::setConfig('system', 'debug_mode_whitelist', explode("\n", str_replace("\r", '', $debug)));
- }
+ if (!is_array(self::getConfig('system', 'enabled_bridges'))) {
+ self::throwConfigError('system', 'enabled_bridges', 'Is not an array');
}
if (