-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsettings.py
79 lines (59 loc) · 2.37 KB
/
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
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
import os
MODE = os.environ.get("MODE") or "development"
if MODE and MODE.lower() == "production":
class production:
SSL_PORT = os.environ["SSL_PORT"]
GRPC_SSL_PORT = os.environ["GRPC_SSL_PORT"]
SSL_CERTIFICATE = os.environ["SSL_CERTIFICATE"]
SSL_KEY = os.environ["SSL_KEY"]
SSL_PEM = os.environ["SSL_PEM"]
SECURE_COOKIE = True
baseConfig = production
else:
class development:
SSL_PORT = os.environ.get("SSL_PORT")
GRPC_SSL_PORT = os.environ.get("GRPC_SSL_PORT")
SSL_CERTIFICATE = os.environ.get("SSL_CERTIFICATE") or ""
SSL_KEY = os.environ.get("SSL_KEY") or ""
SSL_PEM = os.environ.get("SSL_PEM") or ""
SECURE_COOKIE = False
baseConfig = development
class Configurations(baseConfig):
MODE = MODE.lower()
MYSQL_HOST = os.environ.get("MYSQL_HOST")
MYSQL_USER = os.environ.get("MYSQL_USER")
MYSQL_PASSWORD = os.environ.get("MYSQL_PASSWORD")
MYSQL_DATABASE = os.environ.get("MYSQL_DATABASE")
SHARED_KEY = os.environ.get("SHARED_KEY")
HASHING_SALT = os.environ.get("HASHING_SALT")
COOKIE_NAME = "SWOB"
COOKIE_MAXAGE = os.environ.get("COOKIE_MAXAGE") or 900000 # ms 15mins
SESSION_MAXAGE = os.environ.get("SESSION_MAXAGE") or 2700000 # ms 45mins
ENABLE_BLOCKING = True
SHORT_BLOCK_ATTEMPTS = 5
LONG_BLOCK_ATTEMPTS = 3
SHORT_BLOCK_DURATION = 15 # min
LONG_BLOCK_DURATION = 1440 # min 24hrs
ENABLE_OTP = True
FIRST_RESEND_DURATION = 120000 # ms 2min
SECOND_RESEND_DURATION = 300000 # ms 5min
THIRD_RESEND_DURATION = 900000 # ms 15min
FOURTH_RESEND_DURATION = 86400000 # ms 24hrs
HOST = os.environ.get("HOST")
PORT = os.environ.get("PORT")
GRPC_PORT = os.environ.get("GRPC_PORT")
ORIGINS = os.environ.get("ORIGINS")
TWILIO_ACCOUNT_SID = os.environ.get("TWILIO_ACCOUNT_SID")
TWILIO_AUTH_TOKEN = os.environ.get("TWILIO_AUTH_TOKEN")
TWILIO_SERVICE_SID = os.environ.get("TWILIO_SERVICE_SID")
ENABLE_RECAPTCHA = (
False
if (os.environ.get("ENABLE_RECAPTCHA") or "False").lower() == "false"
else (
True
if (os.environ.get("ENABLE_RECAPTCHA") or "False").lower() == "true"
else False
)
)
RECAPTCHA_SECRET_KEY = os.environ.get("RECAPTCHA_SECRET_KEY")
BROADCAST_WHITELIST = os.environ.get("BROADCAST_WHITELIST")