-
Notifications
You must be signed in to change notification settings - Fork 6
/
config.py
40 lines (31 loc) · 1 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
from datetime import timedelta
from apispec import APISpec
from apispec.ext.marshmallow import MarshmallowPlugin
from pydantic import BaseSettings
from pydantic.config import Optional
class Settings(BaseSettings):
DEBUG: Optional[str]
DATABASE_URL: Optional[str]
SECRET_KEY: str = "my_secret_key"
LOG_LEVEL: str = "DEBUG"
RESTX_VALIDATE: bool = True
security_definitions = {
'bearer': {
'type': 'oauth2',
'flow': 'password',
'tokenUrl': '/login',
'in': 'application/json'
}
}
APISPEC_SPEC = APISpec(
title='12 Factor App',
version='v1',
plugins=[MarshmallowPlugin()],
openapi_version='2.0.0',
securityDefinitions=security_definitions
)
APISPEC_SWAGGER_UI_URL = '/'
JWT_SECRET_KEY: str = "secret_key"
JWT_ACCESS_TOKEN_EXPIRES = timedelta(hours=1)
JWT_REFRESH_TOKEN_EXPIRES = timedelta(days=30)
settings = Settings(_env_file='.env', _env_file_encoding='utf-8')