mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-01-17 22:28:22 +01:00
[core] Implemented feature to read config from environment variables (#2100)
This commit is contained in:
parent
4bc534c80f
commit
b395fe2641
@ -150,6 +150,19 @@ final class Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
foreach (getenv() as $envkey => $value) {
|
||||
// Replace all settings with their respective environment variable if available
|
||||
$keyArray = explode('_', $envkey);
|
||||
if($keyArray[0] === 'RSSBRIDGE') {
|
||||
$header = strtolower($keyArray[1]);
|
||||
$key = strtolower($keyArray[2]);
|
||||
if($value === 'true' || $value === 'false') {
|
||||
$value = filter_var($value, FILTER_VALIDATE_BOOLEAN);
|
||||
}
|
||||
Configuration::$config[$header][$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if(!is_string(self::getConfig('system', 'timezone'))
|
||||
|| !in_array(self::getConfig('system', 'timezone'), timezone_identifiers_list(DateTimeZone::ALL_WITH_BC)))
|
||||
self::reportConfigurationError('system', 'timezone');
|
||||
|
Loading…
x
Reference in New Issue
Block a user