36 lines
1.0 KiB
Python
36 lines
1.0 KiB
Python
![]() |
from pydantic_settings import BaseSettings
|
|||
|
from typing import Optional
|
|||
|
|
|||
|
class Settings(BaseSettings):
|
|||
|
PROJECT_NAME: str = "ExamService"
|
|||
|
VERSION: str = "1.0.0"
|
|||
|
API_V1_STR: str = "/api/v1"
|
|||
|
|
|||
|
|
|||
|
MYSQL_USER: str = "mooc"
|
|||
|
MYSQL_PASSWORD: str = "zXpPHKhE7A5x6X3A"
|
|||
|
MYSQL_HOST: str = "localhost"
|
|||
|
MYSQL_PORT: str = "3306"
|
|||
|
MYSQL_DATABASE: str = "mooc"
|
|||
|
|
|||
|
SQLALCHEMY_DATABASE_URI: Optional[str] = None
|
|||
|
SQLALCHEMY_ECHO: bool = True
|
|||
|
|
|||
|
SECRET_KEY: str = "your-secret-key-here" # <20><><EFBFBD><EFBFBD>ʹ<EFBFBD>ø<EFBFBD><C3B8>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
|||
|
ALGORITHM: str = "HS256"
|
|||
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
|
|||
|
|
|||
|
WECHAT_APPID: str = ""
|
|||
|
WECHAT_APPSECRET: str = ""
|
|||
|
|
|||
|
def __init__(self, **kwargs):
|
|||
|
super().__init__(**kwargs)
|
|||
|
self.SQLALCHEMY_DATABASE_URI = (
|
|||
|
f"mysql+pymysql://{self.MYSQL_USER}:{self.MYSQL_PASSWORD}"
|
|||
|
f"@{self.MYSQL_HOST}:{self.MYSQL_PORT}/{self.MYSQL_DATABASE}"
|
|||
|
)
|
|||
|
|
|||
|
class Config:
|
|||
|
env_file = ".env"
|
|||
|
|
|||
|
settings = Settings()
|