from pydantic_settings import BaseSettings from typing import Optional class Settings(BaseSettings): """应用配置类""" # 应用配置 app_name: str = "Project Management API" debug: bool = True port: int = 8000 # 数据库配置 database_url: str # JWT配置 secret_key: str algorithm: str = "HS256" access_token_expire_minutes: int = 30 # 日志配置 log_level: str = "info" class Config: env_file = ".env" env_file_encoding = "utf-8" case_sensitive = False # 创建配置实例 settings = Settings()