From 595a967e2dfea129d86659bb975a566bbec48792 Mon Sep 17 00:00:00 2001 From: Steven Tischer Date: Tue, 2 Jun 2026 13:50:54 +0200 Subject: [PATCH] fix(backend): update API key references to keys from env --- service/src/main/inse/integrations/elasticsearch.py | 8 ++++---- service/src/main/inse/logic.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/service/src/main/inse/integrations/elasticsearch.py b/service/src/main/inse/integrations/elasticsearch.py index 00656fb9..e8346b07 100644 --- a/service/src/main/inse/integrations/elasticsearch.py +++ b/service/src/main/inse/integrations/elasticsearch.py @@ -11,7 +11,7 @@ def search( ) -> dict[str, Any]: headers = { - "Authorization": f"ApiKey {config.settings.elasticsearch_api_key}", + "Authorization": f"ApiKey {config.settings.openalex_works_api_key}", "Content-Type": "application/json" } payload = { @@ -27,7 +27,7 @@ def search( with httpx.Client() as client: response = client.post( - f"{config.settings.elasticsearch_url}/{index}/_search", + f"{config.settings.openalex_works_search_base_url}/{index}/_search", json=payload, headers=headers ) @@ -41,7 +41,7 @@ def get( ) -> dict[str, Any]: headers = { - "Authorization": f"ApiKey {config.settings.elasticsearch_api_key}", + "Authorization": f"ApiKey {config.settings.openalex_works_api_key}", "Content-Type": "application/json" } payload = body @@ -49,7 +49,7 @@ def get( # get document directly with httpx.Client() as client: response = client.get( - f"{config.settings.elasticsearch_url}/{index}/_doc/{doc_id}", + f"{config.settings.openalex_works_search_base_url}/{index}/_doc/{doc_id}", json=payload, headers=headers ) diff --git a/service/src/main/inse/logic.py b/service/src/main/inse/logic.py index 5bd6d268..52ffbe1a 100644 --- a/service/src/main/inse/logic.py +++ b/service/src/main/inse/logic.py @@ -100,7 +100,7 @@ def build_topic_cache(page_size: int = 200, """ output_filename: str = "topic_hierarchy_cache.json" headers = { - "Authorization": f"ApiKey {config.settings.elasticsearch_api_key}", + "Authorization": f"ApiKey {config.settings.openalex_works_api_key}", "Content-Type": "application/json" } @@ -114,7 +114,7 @@ def build_topic_cache(page_size: int = 200, "from": offset, "size": page_size } - response = client.post(config.settings.elasticsearch_url + '/openalex-topics/_search', json=payload, headers=headers) + response = client.post(config.settings.openalex_works_search_base_url + 'openalex-topics/_search', json=payload, headers=headers) response.raise_for_status() data = response.json()