mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-04 23:57:29 +02:00
feat: enable bridges using env var (#3428)
* refactor: bridgefactory, add tests * refactor: move defaultly enabled bridges to config * refactor * refactor * feat: add support for enabling bridges with env var
This commit is contained in:
@@ -26,13 +26,18 @@ final class ConfigurationTest extends TestCase
|
||||
|
||||
public function testValueFromEnv()
|
||||
{
|
||||
putenv('RSSBRIDGE_system_timezone=Europe/Berlin');
|
||||
putenv('RSSBRIDGE_TwitterV2Bridge_twitterv2apitoken=aaa');
|
||||
putenv('RSSBRIDGE_SQLiteCache_file=bbb');
|
||||
Configuration::loadConfiguration([], getenv());
|
||||
$env = [
|
||||
'RSSBRIDGE_system_timezone' => 'Europe/Berlin',
|
||||
'RSSBRIDGE_SYSTEM_MESSAGE' => 'hello',
|
||||
'RSSBRIDGE_system_enabled_bridges' => 'TwitterBridge,GettrBridge',
|
||||
'RSSBRIDGE_system_enable_debug_mode' => 'true',
|
||||
'RSSBRIDGE_fileCache_path' => '/tmp/kek',
|
||||
];
|
||||
Configuration::loadConfiguration([], $env);
|
||||
$this->assertSame('Europe/Berlin', Configuration::getConfig('system', 'timezone'));
|
||||
$this->assertSame('aaa', Configuration::getConfig('TwitterV2Bridge', 'twitterv2apitoken'));
|
||||
$this->assertSame('bbb', Configuration::getConfig('SQLiteCache', 'file'));
|
||||
$this->assertSame('bbb', Configuration::getConfig('sqlitecache', 'file'));
|
||||
$this->assertSame('hello', Configuration::getConfig('system', 'message'));
|
||||
$this->assertSame(true, Configuration::getConfig('system', 'enable_debug_mode'));
|
||||
$this->assertSame('/tmp/kek', Configuration::getConfig('FileCache', 'path'));
|
||||
$this->assertSame(['TwitterBridge', 'GettrBridge'], Configuration::getConfig('system', 'enabled_bridges'));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user