From cd458ca27543bd4d4857522ed79e405b8425ab4a Mon Sep 17 00:00:00 2001 From: Floke Date: Sat, 3 Jan 2026 09:00:52 +0000 Subject: [PATCH] fix(config): Correct API key filename and improve logging - Changes the expected API key filename from 'api_key.txt' to 'gemini_api_key.txt' to match the project standard. - Enhances logging to output the absolute path when an API key file is not found, simplifying future debugging. --- config.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/config.py b/config.py index 85b3b8e2..e607f9d9 100644 --- a/config.py +++ b/config.py @@ -21,7 +21,7 @@ import logging BASE_DIR = os.path.dirname(os.path.abspath(__file__)) CREDENTIALS_FILE = os.path.join(BASE_DIR, "service_account.json") -API_KEY_FILE = os.path.join(BASE_DIR, "api_key.txt") # OpenAI +API_KEY_FILE = os.path.join(BASE_DIR, "gemini_api_key.txt") # Standard für Gemini SERP_API_KEY_FILE = os.path.join(BASE_DIR, "serpApiKey.txt") GENDERIZE_API_KEY_FILE = os.path.join(BASE_DIR, "genderize_API_Key.txt") BRANCH_MAPPING_FILE = None @@ -509,19 +509,20 @@ class Config: def _load_key_from_file(filepath): """Hilfsfunktion zum Laden eines Schluessels aus einer Datei.""" logger = logging.getLogger(__name__) + abs_path = os.path.abspath(filepath) try: - with open(filepath, "r", encoding="utf-8") as f: + with open(abs_path, "r", encoding="utf-8") as f: key = f.read().strip() if key: return key else: - logger.warning(f"Datei '{filepath}' ist leer.") + logger.warning(f"API key file is empty: '{abs_path}'") return None except FileNotFoundError: - logger.info(f"API-Schluesseldatei '{filepath}' nicht gefunden.") + logger.warning(f"API key file not found at path: '{abs_path}'") return None except Exception as e: - logger.error(f"FEHLER beim Lesen der Schluesseldatei '{filepath}': {e}") + logger.error(f"Error reading key file '{abs_path}': {e}") return None # ==============================================================================