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:
Dag 2023-06-11 03:16:03 +02:00 committed by GitHub
parent d9490c6518
commit 0a8fe57003
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 179 additions and 182 deletions

View file

@ -45,5 +45,5 @@ services:
If you want to add a bridge that is not part of [`/bridges`](https://github.com/RSS-Bridge/rss-bridge/tree/master/bridges), you can map a folder to the `/config` folder of the `rss-bridge` container.
1. Create a folder in the location of your docker-compose.yml or your general docker working area (in this example it will be `/home/docker/rssbridge/config` ).
2. Copy your [custom bridges](../05_Bridge_API/01_How_to_create_a_new_bridge.md) to the `/home/docker/rssbridge/config` folder. You can also add your custom [whitelist.txt](../03_For_Hosts/05_Whitelisting.md) file and your custom [config.ini.php](../03_For_Hosts/08_Custom_Configuration.md) to this folder.
2. Copy your [custom bridges](../05_Bridge_API/01_How_to_create_a_new_bridge.md) to the `/home/docker/rssbridge/config` folder. Applies also to [config.ini.php](../03_For_Hosts/08_Custom_Configuration.md).
3. Map the folder to `/config` inside the container. To do that, replace the `</local/custom/path>` from the previous examples with `/home/docker/rssbridge/config`

View file

@ -14,7 +14,7 @@ You can simply press the button below to easily deploy RSS Bridge on Heroku and
![image](../images/fork_button.png)
2. To customise what bridges can be used if need, create a `whitelist.txt` file in your fork and follow the instructions given [here](../03_For_Hosts/05_Whitelisting.md). You dont need to do this if youre fine with the default bridges.
2. To customise what bridges can be used if need, see [here](../03_For_Hosts/05_Whitelisting.md). You dont need to do this if youre fine with the default bridges.
3. [Log in to Heroku](https://dashboard.heroku.com) and create a new app. The app name will be the URL of the RSS Bridge (appname.herokuapp.com)

View file

@ -1,38 +1,26 @@
RSS-Bridge supports whitelists in order to limit the available bridges on your web server.
Modify `config.ini.php` to limit available bridges.
A default whitelist file (`whitelist.default.txt`) is shipped with RSS-Bridge. Please do not edit this file, as it gets replaced when upgrading RSS-Bridge!
## Enable all bridges
You should, however, use this file as template to create your own whitelist (or leave it as is, to keep the default bridges). In order to create your own whitelist perform following actions:
* Copy the file `whitelist.default.txt` in the RSS-Bridge root folder
* Rename the new file to `whitelist.txt`
* Change the lines to satisfy your requirements
RSS-Bridge will automatically detect the `whitelist.txt` and use it. If the file doesn't exist it will default to `whitelist.default.txt` automatically.
# Specific whitelisting
In order to specifically whitelist bridges, open `whitelist.txt` and add one line for each bridge you want to show. Make sure you use normal [line-feeds](https://en.wikipedia.org/wiki/Newline "Line-feed") at the end of a line (LF not [CRLF](https://en.wikipedia.org/wiki/Carriage_return "Carriage-return line-feed")). The bridge name must match the filename of the bridge in the bridges folder (see [folder structure](../04_For_Developers/03_Folder_structure.md)). The name may or may not include the 'Bridge' part.
**Examples**:
```TEXT
FacebookBridge
WikipediaBridge
TwitterBridge
```
enabled_bridges[] = *
```
or
## Enable some bridges
```TEXT
Facebook
Wikipedia
Twitter
```
enabled_bridges[] = TwitchBridge
enabled_bridges[] = GettrBridge
```
# Global whitelisting
## Enable all bridges (legacy shortcut)
In order to globally whitelist all bridges, open the `whitelist.txt` file, remove all contents and just write an asterisk `*` into the file (only this one character).
```
echo '*' > whitelist.txt
```
```TEXT
*
```
## Enable some bridges (legacy shortcut)
```
echo -e "TwitchBridge\nTwitterBridge" > whitelist.txt
```