feat: add git-consistent memory gateway architecture
This commit is contained in:
41
gateway/app/config.py
Normal file
41
gateway/app/config.py
Normal file
@@ -0,0 +1,41 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from functools import lru_cache
|
||||
from pathlib import Path
|
||||
|
||||
from pydantic import Field, model_validator
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore")
|
||||
|
||||
app_name: str = "memory-gateway"
|
||||
app_env: str = "dev"
|
||||
default_branch: str = "main"
|
||||
|
||||
git_remote_url: str = Field(default="", description="Upstream git remote URL or local path")
|
||||
git_mirror_path: Path = Path("/data/git-mirror/repo.git")
|
||||
workspaces_root: Path = Path("/data/workspaces")
|
||||
workspace_state_dir: Path | None = None
|
||||
|
||||
qmd_binary: str = "qmd"
|
||||
qmd_timeout_seconds: int = 300
|
||||
qmd_top_k: int = 5
|
||||
qmd_index_prefix: str = "ws"
|
||||
qmd_update_on_latest_query: bool = True
|
||||
qmd_embed_on_change: bool = True
|
||||
|
||||
xdg_cache_home: Path = Path("/var/lib/qmd/cache")
|
||||
xdg_config_home: Path = Path("/var/lib/qmd/config")
|
||||
|
||||
@model_validator(mode="after")
|
||||
def _normalize_paths(self) -> "Settings":
|
||||
if self.workspace_state_dir is None:
|
||||
self.workspace_state_dir = self.workspaces_root / ".gateway-state"
|
||||
return self
|
||||
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
def get_settings() -> Settings:
|
||||
return Settings()
|
||||
Reference in New Issue
Block a user