-
Notifications
You must be signed in to change notification settings - Fork 2
/
config.py
42 lines (31 loc) · 1.15 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
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
FLASK_DEBUG = True
SECRET_KEY = os.environ.get('SECRET_KEY')
JWT_SECRET_KEY = os.environ.get('JWT_SECRET_KEY')
SQLALCHEMY_TRACK_MODIFICATIONS = False
MAIL_SERVER = os.environ.get('MAIL_SERVER')
MAIL_PORT = os.environ.get('MAIL_PORT')
MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
MAIL_USE_TLS = os.environ.get('MAIL_USE_TLS', False)
ADMINS = [f'no-reply@{MAIL_SERVER}.com']
REAL_IP = 'X-Real-IP'
PROPAGATE_EXCEPTIONS = True
class DevelopmentConfig(Config):
SQLALCHEMY_DATABASE_URI = os.environ.get('SQLALCHEMY_DATABASE_URI')
class TestConfig(Config):
TESTING = True
SQLALCHEMY_DATABASE_URI = f'sqlite3://{os.path.join(basedir, "test.db")}'
class ProductinConfig(Config):
FLASK_DEBUG = False
SQLALCHEMY_DATABASE_URI = os.environ.get('SQLALCHEMY_DATABASE_URI')
config_by_env = {
'dev': DevelopmentConfig,
'test': TestConfig,
'prod':ProductinConfig
}
jwt_key = Config.JWT_SECRET_KEY
if __name__ == '__main__':
print(DevelopmentConfig.SQLALCHEMY_DATABASE_URI)