init: 初始化项目

This commit is contained in:
zwt13703
2026-07-08 20:02:29 +08:00
parent 22590ae7b8
commit 1bb84df4ca
98 changed files with 8535 additions and 2 deletions
+47
View File
@@ -0,0 +1,47 @@
from pydantic_settings import BaseSettings
from functools import lru_cache
class Settings(BaseSettings):
PROJECT_NAME: str = "Doc Forge Reborn"
API_V1_PREFIX: str = "/api/v1"
DEBUG: bool = False
POSTGRES_USER: str = "docforge"
POSTGRES_PASSWORD: str = "docforge"
POSTGRES_DB: str = "docforge"
POSTGRES_HOST: str = "localhost"
POSTGRES_PORT: int = 5432
REDIS_URL: str = "redis://localhost:6379/0"
CELERY_BROKER_URL: str = "redis://localhost:6379/0"
CELERY_RESULT_BACKEND: str = "redis://localhost:6379/1"
SECRET_KEY: str = "change-me-in-production"
DEFAULT_MODEL_ID: str = ""
STORAGE_ROOT: str = "./storage"
MAX_UPLOAD_SIZE: int = 50 * 1024 * 1024
CORS_ORIGINS: list[str] = ["http://localhost:3000", "http://localhost:5173"]
@property
def DATABASE_URL(self) -> str:
return (
f"postgresql+asyncpg://{self.POSTGRES_USER}:{self.POSTGRES_PASSWORD}"
f"@{self.POSTGRES_HOST}:{self.POSTGRES_PORT}/{self.POSTGRES_DB}"
)
@property
def DATABASE_URL_SYNC(self) -> str:
return (
f"postgresql://{self.POSTGRES_USER}:{self.POSTGRES_PASSWORD}"
f"@{self.POSTGRES_HOST}:{self.POSTGRES_PORT}/{self.POSTGRES_DB}"
)
model_config = {"env_file": ".env", "env_file_encoding": "utf-8", "case_sensitive": True}
@lru_cache
def get_settings() -> Settings:
return Settings()