diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d10954..d0b7e75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to Library Desk will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.4.1] - 2025-12-24 + +### Fixed + +- Wiki.js API token now optional - GraphQL API works without authentication +- Container startup failure when `WIKI_GRAPHQL_API` env var not set + ## [1.4.0] - 2025-12-24 ### Added diff --git a/pyproject.toml b/pyproject.toml index 9650620..9bcd80b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "library-desk" -version = "1.4.0" +version = "1.4.1" description = "Coordination service for The Library system - HybridRAG queries, document ingestion, entity extraction, and knowledge consolidation" readme = "README.md" requires-python = ">=3.12" diff --git a/src/clients/wikijs_client.py b/src/clients/wikijs_client.py index c43b647..efe001c 100644 --- a/src/clients/wikijs_client.py +++ b/src/clients/wikijs_client.py @@ -35,16 +35,19 @@ class WikiJSClient: self.graphql_url = f"{self.base_url}/graphql" self.api_token = api_token self.client = httpx.AsyncClient(timeout=30.0) - logger.info(f"Initialized Wiki.js client: {base_url} (using API token)") + auth_mode = "with API token" if api_token else "without auth (open API)" + logger.info(f"Initialized Wiki.js client: {base_url} ({auth_mode})") async def close(self): """Close HTTP client""" await self.client.aclose() - def _ensure_authenticated(self): - """Verify API token is configured.""" - if not self.api_token: - raise Exception("Wiki.js API token not configured") + def _get_headers(self) -> Dict[str, str]: + """Get request headers, optionally including auth token.""" + headers = {"Content-Type": "application/json"} + if self.api_token: + headers["Authorization"] = f"Bearer {self.api_token}" + return headers async def _execute_query( self, @@ -64,18 +67,12 @@ class WikiJSClient: Raises: Exception: If query fails or returns errors """ - # Ensure API token is configured - self._ensure_authenticated() - payload = { "query": query, "variables": variables or {} } - headers = { - "Authorization": f"Bearer {self.api_token}", - "Content-Type": "application/json" - } + headers = self._get_headers() try: response = await self.client.post( diff --git a/src/config.py b/src/config.py index efb90c1..fe11c14 100644 --- a/src/config.py +++ b/src/config.py @@ -43,7 +43,7 @@ class Settings(BaseSettings): # Wiki.js Configuration wikijs_url: str = Field(default="http://wiki:3000", description="Wiki.js URL") - wiki_graphql_api: str = Field(..., description="Wiki.js GraphQL API token (JWT)") + wiki_graphql_api: str = Field(default="", description="Wiki.js GraphQL API token (optional - API may be open)") # Legacy auth fields - kept for backwards compatibility but deprecated wikijs_username: str = Field(default="", description="Wiki.js username (deprecated, use wiki_graphql_api)") wikijs_password: str = Field(default="", description="Wiki.js password (deprecated, use wiki_graphql_api)")