-
Notifications
You must be signed in to change notification settings - Fork 15
/
config.py
81 lines (63 loc) · 2.08 KB
/
config.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class Config:
# Valid message kinds (also spooler directories).
KINDS = ['incoming', 'outgoing', 'checked', 'failed', 'sent']
# Accounts who may access to all messages
#ADMIN_ACCOUNTS = ['superadm']
# Default queue for send message, if not set, keep smsd choose the default queue
#DEFAULTQUEUE = "GSM1"
# Limit for list messages of given kind.
#LIMIT = 10000
# Whitelist for users
#USER_WHITELIST = {
# 'lvv': [ '911' ],
#}
@staticmethod
def init_app(app):
pass
class ProductionConfig(Config):
# Smsd spool path
INCOMING = "/var/spool/sms/incoming"
OUTGOING = "/var/spool/sms/outgoing"
CHECKED = "/var/spool/sms/checked"
FAILED = "/var/spool/sms/failed"
SENT = "/var/spool/sms/sent"
# Users database (htpasswd format)
# Generate hash: openssl passwd -apr1 PASSWORD
# username:$apr1$qSS22H6v$sem/.bUQXjGUIIHb.MXLw1
HTPASSWD_PATH="/usr/local/etc/smstools-http-api/htpasswd.users"
@classmethod
def init_app(cls, app):
Config.init_app(app)
import logging
level = logging.INFO
logFormatter = logging.Formatter('%(asctime)s %(levelname)s: %(message)s')
consoleHandler = logging.StreamHandler()
consoleHandler.setFormatter(logFormatter)
app.logger.setLevel(level)
app.logger.addHandler(consoleHandler)
class DevelopmentConfig(Config):
DEBUG = True
# Smsd spool path
INCOMING = "tmp/incoming"
OUTGOING = "tmp/outgoing"
CHECKED = "tmp/checked"
FAILED = "tmp/failed"
SENT = "tmp/sent"
# Users database (htpasswd format)
# Generate hash: openssl passwd -apr1 PASSWORD
# username:$apr1$qSS22H6v$sem/.bUQXjGUIIHb.MXLw1
HTPASSWD_PATH="htpasswd.users"
class TestConfig(Config):
TESTING = True
DEBUG = True
OUTGOING = "outgoing"
SENT = "sent"
HTPASSWD_PATH = "htpasswd.users"
config = {
'development': DevelopmentConfig,
'production': ProductionConfig,
'test': TestConfig,
'default': DevelopmentConfig
}