rss-bridge
rss-bridge copied to clipboard
[BridgeFactory.php] Add RSSBRIDGE_WHITELIST environment variable support
Enabling/disabling bridges via the whitelist.txt
file can be cumbersome in some setups, for example in containers. This PR introduces a RSSBRIDGE_WHITELIST
environment variable that accepts a wildcard (*
) or bridges names separated by a comma instead of newlines.
After merging, the Whitelisting and Docker will need to be updated.
Edit : I'm of course open to modifications regarding the environment variable name or other changes.
This is integrated in #2100
Your PR looks more complete, I'll decline mine if yours it gets merged.
Fixed by https://github.com/RSS-Bridge/rss-bridge/pull/2100
Fixed by #2100
Was it really? Seems like the whitelist config got eventually removed from that PR by this commit: https://github.com/RSS-Bridge/rss-bridge/pull/2100/commits/99d6203c3095021d180c0694a2a5076e20d7450f.
@gileri, can we get this reopened?
I can see the advantage in this pr. But the container/environment still must be restarted for new env vars to take effect.
An alternative:
diff --git a/config.default.ini.php b/config.default.ini.php
index c1627aac..ae96d108 100644
--- a/config.default.ini.php
+++ b/config.default.ini.php
@@ -12,6 +12,8 @@
; timezone = "UTC" (default)
timezone = "UTC"
+enabled_bridges = Gettr Vimeo
+
If we add it to the config, wouldn't that make it more confusing as to where to actually configure the whitelisted bridges? because then we would have the whitelist.txt and also the config.
One of the reasons for doing it through the environment variable was also to make it easier to deploy to heroku et al.
I dont have a strong feeling either way, but we should come up with a strategy first before we add it to the config file.
I think we should deprecate the usage of whitelist.txt
and move it into a config value enabled_bridges
and also en env value RSSBRIDGE_ENABLED_BRIDGES
or perhaps RSSBRIDGE_ENABLEDBRIDGES
.
After having learnt about arrays in ini files it should be done like this:
enabled_bridges[] = TwitterBridge
enabled_bridges[] = YoutubeBridge
enabled_bridges[] = FooBridge
For the env var, they cant be arrays. They are strings. Not sure how to handle that. Maybe space separated:
RSSBRIDGE_ENABLED_BRIDGES="TwitterBridge YoutubeBridge FooBridge"
So do you want 3 options?
whitelist.txt enabled_bridges config array in config.ini RSSBRIDGE_WHITELIST env variable?
Do you want them to all add up?
Yeah I think all config should be in .ini
file. And whitelist.txt and env overshadows for convenience.
overshadow meaning replace? or just add.
So if I have a whitelist with BridgeA, an ini selection of BridgeB and BridgeC and an env variable of BridgeA and BridgeD, should A B C and D be selected?
Had not thought about that. I mean replace yes.
So in my example, only A and D would be selected since B and C are only in the .ini and you want that replaced?
I think thats very complicated. A simple addition would make more sense for the users I think.
Its also how most other things work. Access rights are usually additive and in this case I would see it as "bridges a user has access to".
What you think @gileri ?
fixed in https://github.com/RSS-Bridge/rss-bridge/pull/3428
@gileri
Sorry for the delayed answer. Had a look over #3428, seems perfect. Thank you @dvikan, and @Bockiii for the review !