-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
74 lines (53 loc) · 1.76 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
# config.py
import os
class Config(object):
"""
Common configurations
"""
# Put any configurations here that are common across all environments
AMIV_API_URL = "https://api-dev.amiv.ethz.ch"
class DevelopmentConfig(Config):
"""
Development configurations
"""
DEBUG = True
SQLALCHEMY_ECHO = True
TESTING = False
SQLALCHEMY_TRACK_MODIFICATIONS = False
TEMPLATES_AUTO_RELOAD = True
SECURITY_NUM_PROXY_LEVELS = 0 # set to negative to disable IP banning feature
SECURITY_MAX_FAILED_LOGIN_TRIES = 5
SECURITY_UNBANNABLE_SUBNETS = ['129.132.0.0/16', '127.0.0.1/32']
def cl(obj):
if obj is None:
return ""
class AWSConfig(Config):
"""
Production configurations
"""
DEBUG = False
TESTING = False
SQLALCHEMY_TRACK_MODIFICATIONS = False
SECURITY_NUM_PROXY_LEVELS = 1 # set to negative to disable IP banning feature
SECURITY_MAX_FAILED_LOGIN_TRIES = 5
SECURITY_UNBANNABLE_SUBNETS = ['129.132.0.0/16']
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://'\
+ cl(os.getenv('RDS_USERNAME')) + ':' + cl(os.getenv('RDS_PASSWORD'))\
+ '@' + cl(os.getenv('RDS_HOSTNAME'))\
+ '/' + cl(os.getenv('RDS_DB_NAME'))
SECRET_KEY = os.getenv('SECRET_KEY')
class ISGEEConfig(Config):
"""
Production configurations
"""
DEBUG = False
TESTING = False
SQLALCHEMY_TRACK_MODIFICATIONS = False
SECURITY_NUM_PROXY_LEVELS = 0 # set to negative to disable IP banning feature
SECURITY_MAX_FAILED_LOGIN_TRIES = 5
SECURITY_UNBANNABLE_SUBNETS = ['129.132.0.0/16']
app_config = {
'development': DevelopmentConfig,
'prod_aws': AWSConfig,
'prod_isgee': ISGEEConfig
}