| 12345678910111213141516171819202122232425262728293031 |
- from pydantic_settings import BaseSettings
- from functools import lru_cache
- class Settings(BaseSettings):
- PROJECT_NAME: str
- API_V1_STR: str
- MINIO_ENDPOINT: str
- # Java API 配置
- JAVA_API_BASE_URL: str
- JWT_SECRET_KEY: str
- JWT_ALGORITHM: str
- # img 单独配置
- IMG_MINIO_ACCESS_KEY: str
- IMG_MINIO_SECRET_KEY: str
- IMG_MINIO_BUCKET_NAME: str
- # MinIO 连接配置
- MINIO_SECURE: bool = False
- # CORS 配置(可选,用逗号分隔多个域名)
- CORS_ORIGINS: str = "*"
- # 文件上传限制(字节,默认 100MB)
- MAX_UPLOAD_SIZE: int = 100 * 1024 * 1024
- class Config:
- env_file = ".env"
- @lru_cache()
- def get_settings():
- return Settings()
- settings = get_settings()
|