-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig.py
60 lines (43 loc) Β· 1.51 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
"""Module contains configuration classes for different enviroments."""
import os
from datetime import timedelta
class Config():
"""Model base config object that can inherited by other configs."""
SECRET_KEY = os.environ.get('SECRET')
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
SQLALCHEMY_TRACK_MODIFICATIONS = False
CSRF_ENABLED = True
DEBUG = False
TESTING = False
DEVELOPMENT = False
SWAGGER_UI_DOC_EXPANSION = 'list'
SWAGGER_UI_JSONEDITOR = True
JWT_ACCESS_TOKEN_EXPIRES = timedelta(minutes=120)
class DevelopmentConfig(Config):
"""Model Development enviroment config object."""
DEBUG = True
DEVELOPMENT = True
SQLALCHEMY_DATABASE_URI = os.environ.get('DEV_DATABASE') or \
'sqlite:///:memory:'
class TestingConfig(Config):
"""Model Testing enviroment config object."""
DEBUG = True
TESTING = True
SQLALCHEMY_TRACK_MODIFICATIONS = True
JWT_ACCESS_TOKEN_EXPIRES = timedelta(minutes=1)
SQLALCHEMY_DATABASE_URI = os.environ.get('TEST_DATABASE') or \
'sqlite:///:memory:'
class ProductionConfig(Config):
"""Model Production enviroment config object."""
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL')
class StagingConfig(Config):
"""Model Staging enviroment config object."""
DEBUG = True
DEVELOPMENT = True
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL')
config = {
'default': DevelopmentConfig,
'testing': TestingConfig,
'production': ProductionConfig,
'stage': StagingConfig
}