forked from lamby/django-slack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app_settings.py
35 lines (24 loc) · 953 Bytes
/
app_settings.py
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
from django.conf import settings
def setting(suffix, default):
@property
def fn(self):
return getattr(settings, 'SLACK_{}'.format(suffix), default)
return fn
class AppSettings(object):
DEFAULT_ENDPOINT_URL = 'https://slack.com/api/chat.postMessage'
DEFAULT_BACKEND = (
'django_slack.backends.DisabledBackend'
if settings.DEBUG
else 'django_slack.backends.UrllibBackend'
)
TOKEN = setting('TOKEN', None)
CHANNEL = setting('CHANNEL', '#general')
USERNAME = setting('USERNAME', 'bot')
ICON_URL = setting('ICON_URL', None)
ICON_EMOJI = setting('ICON_EMOJI', None)
ENDPOINT_URL = setting('ENDPOINT_URL', DEFAULT_ENDPOINT_URL)
BACKEND = setting('BACKEND', DEFAULT_BACKEND)
BACKEND_FOR_QUEUE = setting('BACKEND_FOR_QUEUE', DEFAULT_BACKEND)
FAIL_SILENTLY = setting('FAIL_SILENTLY', False)
AS_USER = setting('AS_USER', False)
app_settings = AppSettings()