-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathconfig.py
101 lines (73 loc) · 2.36 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import os
class Config:
"""
Configurations shared by all env.
"""
SECRET_KEY = os.getenv('SECRET_KEY', 'THIS IS AN INSECURE SECRET')
CSRF_ENABLED = True
SQLALCHEMY_TRACK_MODIFICATIONS = False
# Flask-Mail settings
MAIL_SERVER = 'smtp.163.com'
MAIL_PORT = 465
MAIL_USE_SSL = True
MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
MAIL_DEFAULT_SENDER = '"inception"<[email protected]>'
# Mail switch option
MAIL_ON_OFF = 'OFF'
# Inception DDL switch option
CRITICAL_DDL_ON_OFF = 'ON'
# LDAP switch option
LDAP_ON_OFF = 'OFF'
class DevelopmentConfig(Config):
"""
Configurations used for development env.
"""
DEBUG = True
SQLALCHEMY_DATABASE_URI = os.getenv(
'DEV_DATABASE_URL',
'mysql+pymysql://root:[email protected]:3306/inception_web?charset=utf8'
)
# Inception settings
INCEPTION_HOST = '127.0.0.1'
INCEPTION_PORT = 6669
# Inception backup settings
INCEPTION_REMOTE_BACKUP_HOST = '127.0.0.1'
INCEPTION_REMOTE_BACKUP_PORT = 3306
INCEPTION_REMOTE_BACKUP_USER = 'root'
INCEPTION_REMOTE_BACKUP_PASSWORD = 'mysql'
# Flask LDAP settings
LDAP_OPENLDAP = True
LDAP_OBJECTS_DN = 'dn'
LDAP_REALM_NAME = 'OpenLDAP Authentication'
LDAP_HOST = '10.10.106.201'
LDAP_BASE_DN = 'cn=users,cn=accounts,dc=in66,dc=cc'
LDAP_USERNAME = ''
LDAP_PASSWORD = ''
LDAP_USER_OBJECT_FILTER = '(&(objectclass=inetOrgPerson)(uid=%s))'
LDAP_LOGIN_VIEW = 'login'
# Celery Broker setting
CELERY_BROKER_URL = 'redis://127.0.0.1:6379'
# Celery backend setting
CELERY_RESULT_BACKEND = 'redis://127.0.0.1:6379'
# Celery TimeZone
# CELERY_ENABLE_UTC = False
# CELERY_TIMEZONE = 'UTC'
CELERY_TIMEZONE = 'Asia/Shanghai'
# Celery other settings
CELERY_TASK_SERIALIZER = 'json'
CELERY_TRACK_STARTED = True
# Celery ETA/countdown setting for solving tasks executed again, and again in a loop
BROKER_TRANSPORT_OPTIONS = {'visibility_timeout': 18000} # 5 hours
# Celery Tasks
CELERY_IMPORTS = ("app.tasks",)
class TestingConfig(Config):
pass
class ProductionConfig(Config):
pass
config = {
'development': DevelopmentConfig,
'testing': TestingConfig,
'production': ProductionConfig,
'default': DevelopmentConfig
}