-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathconfig.py
53 lines (38 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
52
53
from environs import Env
# Reading from the .env file
env = Env()
env.read_env()
class Config(object):
"""
These are the default configurations of the API.
"""
SANIC_DEBUG: bool = env.bool('SANIC_DEBUG', default=False)
SANIC_TESTING: bool = env.bool('SANIC_TESTING', default=False)
SANIC_HOST: str = env.str('SANIC_HOST', default='0.0.0.0')
SANIC_PORT: int = env.int('SANIC_PORT', default=8000)
SANIC_ENV: str = env.str('SANIC_ENV', default='dev')
SANIC_FORWARDED_SECRET: str = env.str('SANIC_FORWARDED_SECRET')
SECRET_KEY: str = env.str('SECRET_KEY')
DATABASE_URI: str = env.str('DATABASE_URI')
class DevelopmentConfig(Config):
"""
These configurations are to be used in a development environment.
This class inherits the default attributes from `Config` and defines
those that can only be found in development mode.
"""
DEBUG: bool = env.bool('SANIC_DEBUG')
class TestingConfig(Config):
"""
These configurations are to be used in a testing environment.
This class inherits the default attributes from `Config` and defines
those that can only be found in testing mode.
"""
TESTING: bool = True
class ProductionConfig(Config):
"""
These configurations are to be used in a production environment.
This class inherits the default attributes from `Config` and defines
those that can only be found in production mode.
"""
TESTING: bool = False
DEBUG: bool = False