diff --git a/.env.example b/.env.example index 4e03065..ef3ba42 100644 --- a/.env.example +++ b/.env.example @@ -48,6 +48,14 @@ OLLAMA_BASE_URL=http://localhost:11434 # SearXNG (self-hosted search) SEARXNG_URL=http://localhost:8080 +# ============================================================================= +# Database (PostgreSQL) +# ============================================================================= + +POSTGRES_HOST=localhost:5432 +POSTGRES_USER=core_api +POSTGRES_PASSWORD=your-password + # ============================================================================= # Vector Database # ============================================================================= diff --git a/pyproject.toml b/pyproject.toml index 25f8526..329ce7b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "core-api" -version = "1.3.3" +version = "1.3.4" description = "Core Code API - Infrastructure management and tools API" readme = "README.md" requires-python = ">=3.12" diff --git a/src/config.py b/src/config.py index 0a96c29..1aa219f 100644 --- a/src/config.py +++ b/src/config.py @@ -106,6 +106,17 @@ class Settings(BaseSettings): homeassistant_token: str # Required - set HOMEASSISTANT_TOKEN in .env homeassistant_timeout: int = 30 + # PostgreSQL Database + postgres_host: str # Required - set POSTGRES_HOST in .env (e.g., localhost:5432) + postgres_user: str = "core_api" + postgres_password: str # Required - set POSTGRES_PASSWORD in .env + postgres_database: str = "core_api" + + @property + def database_url(self) -> str: + """Construct database URL from components""" + return f"postgresql://{self.postgres_user}:{self.postgres_password}@{self.postgres_host}/{self.postgres_database}" + # OIDC Authentication (Authentik) oidc_enabled: bool = False # Set to True to require authentication oidc_issuer: str = "https://auth.schweitz.net/application/o/core-api/"