Files

41 lines
1.0 KiB
Python
Raw Permalink Normal View History

2026-03-11 16:28:04 +08:00
from pathlib import Path
from pydantic_settings import BaseSettings, SettingsConfigDict
2026-03-13 23:29:55 +08:00
ENV_FILE_PATH = Path(__file__).resolve().parents[2] / ".env"
2026-03-11 16:28:04 +08:00
class Settings(BaseSettings):
model_config = SettingsConfigDict(
2026-03-13 23:29:55 +08:00
env_file=ENV_FILE_PATH,
2026-03-11 16:28:04 +08:00
env_file_encoding="utf-8",
extra="ignore",
)
DATABASE_URL: str = "postgresql+asyncpg://fundtracer:fundtracer_dev@localhost:5432/fundtracer"
DATABASE_URL_SYNC: str = "postgresql://fundtracer:fundtracer_dev@localhost:5432/fundtracer"
REDIS_URL: str = "redis://localhost:6379/0"
UPLOAD_DIR: str = "./uploads"
OCR_API_KEY: str = ""
OCR_API_URL: str = ""
2026-03-12 12:32:29 +08:00
OCR_MODEL: str = ""
2026-03-13 23:29:55 +08:00
OCR_ALLOW_MOCK_FALLBACK: bool = False
2026-03-12 19:57:30 +08:00
OCR_PARALLELISM: int = 4
2026-03-11 16:28:04 +08:00
LLM_API_KEY: str = ""
LLM_API_URL: str = ""
LLM_MODEL: str = ""
SECRET_KEY: str = "change-me-in-production"
DEBUG: bool = True
@property
def upload_path(self) -> Path:
p = Path(self.UPLOAD_DIR)
p.mkdir(parents=True, exist_ok=True)
return p
settings = Settings()