-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
51 lines (42 loc) · 1.46 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
"""Flask config."""
import os
from os import environ
from dotenv import find_dotenv, load_dotenv
dotenv_path = os.path.join(os.path.dirname(__file__), '.env')
if os.path.exists(dotenv_path):
load_dotenv(dotenv_path)
class Config:
"""Base config."""
DEBUG = False
TESTING = False
SECRET_KEY = os.getenv('SECRET_KEY')
SQLALCHEMY_TRACK_MODIFICATIONS = False
class DevelopmentConfig(Config):
"""Config for development only."""
ENV = 'development'
DEBUG = True
TESTING = True
SQLALCHEMY_DATABASE_URI = environ.get('DEV_DATABASE_URI')
JWT_ACCESS_LIFESPAN = {'days': 1}
JWT_REFRESH_LIFESPAN = {'days': 30}
MAIL_SERVER = environ.get("MAIL_SERVER")
MAIL_USERNAME = environ.get("MAIL_USERNAME")
MAIL_PASSWORD = environ.get("MAIL_PASSWORD")
MAIL_PORT = environ.get("MAIL_PORT")
MAIL_DEFAULT_SENDER = environ.get('MAIL_DEFAULT_SENDER')
MAIL_SUPPRESS_SEND = False
class ProductionConfig(Config):
"""Config for profuction."""
ENV = 'production'
SQLALCHEMY_DATABASE_URI = environ.get('PROD_DATABASE_URI')
JWT_ACCESS_LIFESPAN = {'hours': 24}
JWT_REFRESH_LIFESPAN = {'days': 30}
MAIL_SERVER = environ.get("MAIL_SERVER")
MAIL_USERNAME = environ.get("MAIL_USERNAME")
MAIL_PASSWORD = environ.get("MAIL_PASSWORD")
MAIL_PORT = environ.get("MAIL_PORT")
MAIL_DEFAULT_SENDER = environ.get('MAIL_DEFAULT_SENDER')
config = {
"Production": ProductionConfig,
"Development": DevelopmentConfig
}