from pydantic_settings import BaseSettings from typing import List class Settings(BaseSettings): # 项目信息 PROJECT_NAME: str = "图绘 API" VERSION: str = "1.0.0" API_PREFIX: str = "/api" # 数据库配置 DATABASE_URL: str = "sqlite:///./test.db" # 使用SQLite进行测试 # DATABASE_URL: str = "mysql+pymysql://root:password@localhost:3306/aishej" # MySQL配置 # JWT 配置 SECRET_KEY: str = "change-me-in-env" ALGORITHM: str = "HS256" ACCESS_TOKEN_EXPIRE_MINUTES: int = 1440 # 24小时 # 文件配置 UPLOAD_DIR: str = "./uploads" MAX_FILE_SIZE: int = 52428800 # 50MB # 水印配置 WATERMARK_TEXT: str = "图绘 Tuhui.cloud" WATERMARK_OPACITY: int = 128 # 缩略图配置 THUMBNAIL_SIZE: int = 400 THUMBNAIL_QUALITY: int = 85 # CORS 配置(生产环境配置为具体域名) ALLOWED_ORIGINS: List[str] = [ "https://tuhui.cloud", "https://www.tuhui.cloud", "http://localhost:5173", "http://127.0.0.1:5173", ] # 易收米支付配置 YSM_APPID: str = "" YSM_APPSECRET: str = "" YSM_NOTIFY_URL: str = "https://tuhui.cloud/api/payment/notify" # 支付回调地址 YSM_CALLBACK_URL: str = "https://tuhui.cloud/payment/success" # 支付成功跳转地址 YSM_NOPAY_URL: str = "https://tuhui.cloud/payment/cancel" # 未支付跳转地址 WECOM_BOT_WEBHOOK: str = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=cc88bdef-a13f-4d7e-bdb6-ee51b68b8205" class Config: env_file = ".env" case_sensitive = True settings = Settings()