-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
60 lines (40 loc) · 1.44 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
# project/server/config.py
import os
import datetime
basedir = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'db')
class BaseConfig(object):
"""Base configuration."""
DEBUG = False
DEBUG_TB_ENABLED = False
DEBUG_TB_INTERCEPT_REDIRECTS = False
SQLALCHEMY_TRACK_MODIFICATIONS = False
PREFERRED_URL_SCHEME = 'https'
IS_ONLINE = False
INIT_STATE = 0 # 0: not initialized, 1: initializing, 2: initialized
MASTER_PASSWORD_EXPIRY = datetime.timedelta(minutes=10)
SETTINGS_FILE = 'db/settings.db'
USE_ETHEREUM = False
class DevelopmentTestConfig(BaseConfig):
DEBUG = True
BCRYPT_LOG_ROUNDS = 4
class DevelopmentConfig(DevelopmentTestConfig):
"""Development configuration."""
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'data-dev.sqlite')
DEBUG_TB_ENABLED = True
class TestingConfig(DevelopmentTestConfig):
"""Testing configuration."""
TESTING = True
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'data-test.sqlite')
DEBUG_TB_ENABLED = False
PRESERVE_CONTEXT_ON_EXCEPTION = False
class ProductionConfig(BaseConfig):
"""Production configuration."""
DEBUG = False
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'storage.db')
DEBUG_TB_ENABLED = False
configs = {
'development': DevelopmentConfig,
'testing': TestingConfig,
'production': ProductionConfig,
'default': DevelopmentConfig
}