-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
65 lines (49 loc) · 1.55 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
import os
from datetime import timedelta
class Config(object):
TESTING = False
DB_SERVER = ""
SQLALCHEMY_TRACK_MODIFICATIONS = False
SESSION_TYPE = "memcached"
PROPAGATE_EXCEPTIONS = True
JSON_SORT_KEYS = False
JWT_TOKEN_LOCATION = ["headers"]
SECURITY_PASSWORD_SALT = os.environ.get("SECURITY_PASSWORD_SALT")
EMAIL_SENDER = os.environ.get("EMAIL_SENDER")
DOMAIN_URL = os.environ.get("DOMAIN_URL")
@property
def SQLALCHEMY_DATABASE_URI(self):
return f"postgresql://{os.environ.get('DB_USER')}:{os.environ.get('DB_PASSWORD')}@{self.DB_SERVER}/{os.environ.get('DB_NAME')}"
@property
def JWT_SECRET_KEY(self):
return os.environ.get("JWT_SECRET_KEY")
@property
def EMAIL_SENDER(self):
return os.environ.get("EMAIL_SENDER")
@property
def DOMAIN_URL(self):
return os.environ.get("DOMAIN_URL")
@property
def SECRET_KEY(self):
return os.environ.get("SECRET_KEY")
@property
def JWT_ACCESS_TOKEN_EXPIRES(self):
return timedelta(hours=1)
@property
def JWT_REFRESH_TOKEN_EXPIRES(self):
return timedelta(days=30)
class ProductionConfig(Config):
pass
class DevelopmentConfig(Config):
DB_SERVER = "localhost"
class TestingConfig(Config):
DB_SERVER = "localhost"
TESTING = True
JWT_SECRET_KEY = "secret"
SECRET_KEY = "secret"
SECURITY_PASSWORD_SALT = "salt"
EMAIL_SENDER = "[email protected]"
DOMAIN_URL = ""
@property
def SQLALCHEMY_DATABASE_URI(self):
return "sqlite:///:memory:"