Files
tuhui/backend/app/core/config.py
2026-03-08 19:28:32 +08:00

52 lines
1.6 KiB
Python

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 = "your-secret-key-change-this"
ALGORITHM: str = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES: int = 1440 # 24小时
# 文件配置
UPLOAD_DIR: str = "./uploads"
MAX_FILE_SIZE: int = 52428800 # 50MB
# 水印配置
WATERMARK_TEXT: str = "爱设计 AiSheji.com"
WATERMARK_OPACITY: int = 128
# 缩略图配置
THUMBNAIL_SIZE: int = 400
THUMBNAIL_QUALITY: int = 85
# CORS 配置(生产环境配置为具体域名)
ALLOWED_ORIGINS: List[str] = [
"https://backend.huijie168.uk",
"https://app.huijie168.uk",
"https://run.huijie168.uk",
"https://huijie168.uk",
"https://www.huijie168.uk"
]
# 易收米支付配置
YSM_APPID: str = "YSMcd16b45d"
YSM_APPSECRET: str = "899850e778e8d2b53e4c4a4e88695688"
YSM_NOTIFY_URL: str = "https://backend.huijie168.uk/api/payment/notify" # 支付回调地址
YSM_CALLBACK_URL: str = "https://run.huijie168.uk/payment/success" # 支付成功跳转地址
YSM_NOPAY_URL: str = "https://run.huijie168.uk/payment/cancel" # 未支付跳转地址
class Config:
env_file = ".env"
case_sensitive = True
settings = Settings()