| """ | |
| 配置管理模块 | |
| """ | |
| from pydantic_settings import BaseSettings | |
| from typing import Optional | |
| class Settings(BaseSettings): | |
| """系统配置""" | |
| # Redis配置 | |
| redis_host: str = "localhost" | |
| redis_port: int = 6379 | |
| redis_db: int = 0 | |
| redis_password: Optional[str] = None | |
| # API配置 | |
| api_host: str = "0.0.0.0" | |
| api_port: int = 7860 | |
| debug: bool = True | |
| # 日志配置 | |
| log_level: str = "INFO" | |
| class Config: | |
| env_file = ".env" | |
| # 全局配置实例 | |
| settings = Settings() |