Program/mooc/core/config.py
烟雨如花 4f34f5b8be init
2024-12-31 22:27:04 +08:00

36 lines
1.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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()