44 lines
1023 B
Python
44 lines
1023 B
Python
"""
|
|
应用配置
|
|
"""
|
|
from typing import List
|
|
from pydantic_settings import BaseSettings
|
|
from pydantic import AnyHttpUrl
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""应用配置类"""
|
|
|
|
# 项目信息
|
|
PROJECT_NAME: str = "PBMDB API"
|
|
VERSION: str = "1.0.0"
|
|
API_V1_STR: str = "/api/v1"
|
|
|
|
# 数据库配置
|
|
DATABASE_URL: str = "postgresql://webws_admin:password@postgres:5432/webws_database"
|
|
|
|
# CORS 配置
|
|
ALLOWED_ORIGINS: List[str] = [
|
|
"https://amiap.hzau.edu.cn",
|
|
"http://localhost:3000", # 本地开发
|
|
]
|
|
|
|
# 安全配置
|
|
SECRET_KEY: str = "your-secret-key-here-change-in-production"
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 7 # 7 days
|
|
|
|
# 文件上传配置
|
|
MAX_UPLOAD_SIZE: int = 1024 * 1024 * 100 # 100MB
|
|
UPLOAD_DIR: str = "/app/uploads"
|
|
|
|
# 分页配置
|
|
DEFAULT_PAGE_SIZE: int = 20
|
|
MAX_PAGE_SIZE: int = 100
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
case_sensitive = True
|
|
|
|
|
|
settings = Settings()
|