config.py 662 B

123456789101112131415161718192021222324252627
  1. from pathlib import Path
  2. from pydantic_settings import BaseSettings
  3. class Settings(BaseSettings):
  4. app_name: str = "BambuTrack"
  5. debug: bool = True
  6. # Paths
  7. base_dir: Path = Path(__file__).resolve().parent.parent.parent.parent
  8. archive_dir: Path = base_dir / "archive"
  9. static_dir: Path = base_dir / "static"
  10. database_url: str = f"sqlite+aiosqlite:///{base_dir}/bambutrack.db"
  11. # API
  12. api_prefix: str = "/api/v1"
  13. class Config:
  14. env_file = ".env"
  15. env_file_encoding = "utf-8"
  16. settings = Settings()
  17. # Ensure directories exist
  18. settings.archive_dir.mkdir(exist_ok=True)
  19. settings.static_dir.mkdir(exist_ok=True)