-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
36 lines (23 loc) · 1.01 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
from pydantic import AnyHttpUrl, BaseSettings, EmailStr, validator
from typing import List, Optional, Union
from enum import Enum
class Settings(BaseSettings):
API_V1_STR: str = "/api/v1"
JWT_RSA_KEY = open('shipapi/appconfig/jwtsigning.key').read()
JWT_RSA_PUB = open('shipapi/appconfig/jwtsigning.pub').read()
ALGORITHM: str = "RS384"
# We don't use symmetric cipher algo anymore
JWT_SECRET: str = "TW!BMP9yVRiDEziTsekVoHZJFcXQgZf8"
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 8
CORS_ORIGINS: List[AnyHttpUrl] = []
@validator("CORS_ORIGINS", pre=True)
def assemble_cors_origins(cls, v: Union[str, List[str]]) -> Union[List[str], str]:
if isinstance(v, str) and not v.startswith("["):
return [i.strip() for i in v.split(",")]
elif isinstance(v, (list, str)):
return v
raise ValueError(v)
SQLALCHEMY_DATABASE_URI: Optional[str] = "sqlite:///navalship.db"
class Config:
case_sensitive = True
settings = Settings()