-
Notifications
You must be signed in to change notification settings - Fork 1
/
Configs.py
53 lines (33 loc) · 1.16 KB
/
Configs.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import json
class Configs:
def __init__(self):
self._db = {}
self._categories = []
self._slack_channels = []
self._print_to_slack = False
self._server_port = 5001
self._read_config_file()
def _read_config_file(self):
print 'Reading config file...'
with open('config.json') as data_file:
data = json.load(data_file)
if 'db' in data:
self._db = data['db']
if 'categories' in data:
self._categories = data['categories']
if 'slack_channels' in data:
self._slack_channels = data['slack_channels']
if 'print_to_slack' in data:
self._print_to_slack = data['print_to_slack']
if 'server_port' in data:
self._server_port = data['server_port']
def get_db(self):
return self._db
def get_categories(self):
return self._categories
def get_slack_channels(self):
return self._slack_channels
def get_print_to_slack(self):
return self._print_to_slack
def get_server_port(self):
return self._server_port