-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.py.docker
executable file
·66 lines (53 loc) · 3.06 KB
/
settings.py.docker
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/python
# -*- coding: utf-8 -*-
from os import environ
from rssfeed import RssFeed
from environs import Env
env = Env()
# Paste the Mattermost webhook URL you created here
# See also: https://github.com/mattermost/platform/blob/master/doc/integrations/webhooks/Incoming-Webhooks.md
mattermost_webhook_url = env.str('MATTERMOST_HOOK_URL')
# Paste the Mattermost integration Token you created here
# See also: https://docs.mattermost.com/developer/slash-commands.html
mattermost_integration_token = env.str('MATTERMOST_CMD_TOKEN' ,'')
# Set the delay between feed pulls to your needs. 5 minutes should be okay.
delay_between_pulls = env.int('RSS_DELAY_PULL', 60 * 5)
# Trust only signed SSL certificate?
verify_cert = env.bool('RSS_VERIFY_SSL_CERT', False)
# Deactivate logging for debug purposes
silent_mode = env.bool('RSS_SILENT_MODE', True)
# Name of the user that responds to integration commands
integration_bot_name = env.str('INTEGRATION_BOT_NAME', 'RSS-Bot')
# Image URL for the user that responds to integration commands
integration_bot_img = env.str('INTEGRATION_BOT_IMG', '')
# Address integration bot must listen to ('' for every host)
integration_listening_addr = env.str('INTEGRATION_LISTENING_ADDR', '')
# Port integration bot must listen to
integration_listening_port = env.int('INTEGRATION_LISTENING_PORT', 8080)
# Don't publish the article fetched on the first run (avoid spamming when rebooting a lot the bot)
skip_init_article = env.bool('RSS_SKIP_INIT_ARTICLE', True)
# Default settings for the feeds
default_show_name = env.bool('RSS_SHOW_NAME', True)
default_show_title = env.bool('RSS_SHOW_TITLE', True)
default_show_description = env.bool('RSS_SHOW_DESCR', True)
default_show_url = env.bool('RSS_SHOW_URL', True)
default_channel = env.str('MATTERMOST_CHANNEL')
# Your feeds come here:
# RssFeed('Feed name', 'Feed URL', 'Image URL', 'Mattermost username', 'Mattermost channel',
# show name, show title, show description, show url)
#
# show name, show title, show description, show url can be True or False; at least one of them should be True
# show description (longer text or full article) seems not to work with every feed.
# Set to False it if a feed doesnt´t work.
# Hint: Channel overriding seems not to work with the channel 'Town Square'
feeds = [RssFeed(
k.replace('RSS_FEED_', ''),
v.split(';')[0],
v.split(';')[1] if v.count(';') >= 1 else '',
v.split(';')[2] if v.count(';') >= 2 else env('MATTERMOST_USERNAME', k.replace('RSS_FEED_', '')),
v.split(';')[3] if v.count(';') >= 3 else default_channel,
v.split(';')[4] == 'True' if v.count(';') >= 4 else default_show_name,
v.split(';')[5] == 'True' if v.count(';') >= 5 else default_show_title,
v.split(';')[6] == 'True' if v.count(';') >= 6 else default_show_description,
v.split(';')[7] == 'True' if v.count(';') >= 7 else default_show_url)
for k,v in environ.iteritems() if k.startswith('RSS_FEED_')]