diff --git a/gen_photo_alt_text/config.py b/gen_photo_alt_text/config.py index 703d656..befd2bf 100644 --- a/gen_photo_alt_text/config.py +++ b/gen_photo_alt_text/config.py @@ -3,7 +3,6 @@ from __future__ import annotations import os -from pathlib import Path from typing import Dict from dotenv import load_dotenv @@ -15,32 +14,6 @@ class ConfigError(RuntimeError): """Raised when critical configuration is missing.""" -LEGACY_KEY_MAP = { - "immich": "IMMICH_API_KEY", - "openai": "OPENAI_API_KEY", -} - - -def _load_legacy_api_keys(path: Path) -> Dict[str, str]: - """Parse the legacy ``api_keys`` file if it exists.""" - - if not path.exists(): - return {} - - values: Dict[str, str] = {} - for line in path.read_text().splitlines(): - line = line.strip() - if not line or line.startswith("#"): - continue - if "=" not in line: - continue - key, value = [piece.strip() for piece in line.split("=", 1)] - mapped_key = LEGACY_KEY_MAP.get(key.lower()) - if mapped_key and value: - values[mapped_key] = value - return values - - def load_settings() -> Dict[str, str]: """Load configuration from environment variables and ``api_keys``.""" @@ -62,11 +35,6 @@ def load_settings() -> Dict[str, str]: "MASTODON_CLIENT_SECRET": os.getenv("MASTODON_CLIENT_SECRET", ""), } - legacy_values = _load_legacy_api_keys(Path("api_keys")) - for key, value in legacy_values.items(): - if not settings.get(key): - settings[key] = value - missing = [ key for key in ("IMMICH_API_KEY", "OPENAI_API_KEY") if not settings.get(key) ]