refactor: [30388f42] Entferne Legacy-Token-Dateien und Abhängigkeiten
- Bereinigt alle Dockerfiles (market, content, b2b) von COPY gemini_api_key.txt. - Aktualisiert market_intel_orchestrator.py und b2b_marketing_orchestrator.py, um API-Keys strikt aus Umgebungsvariablen zu lesen. - Verhindert Build-Fehler durch fehlende lokale Token-Dateien.
This commit is contained in:
@@ -37,26 +37,24 @@ logging.basicConfig(
|
||||
logger = logging.getLogger(__name__)
|
||||
# --- END AUTARKES LOGGING SETUP --- #
|
||||
|
||||
def load_gemini_api_key(file_path="gemini_api_key.txt"):
|
||||
try:
|
||||
with open(file_path, "r") as f:
|
||||
api_key = f.read().strip()
|
||||
return api_key
|
||||
except Exception as e:
|
||||
logger.critical(f"Fehler beim Laden des Gemini API Keys: {e}")
|
||||
raise
|
||||
def load_gemini_api_key(file_path=None):
|
||||
"""Loads the Gemini API Key from environment variables."""
|
||||
api_key = os.getenv("GEMINI_API_KEY")
|
||||
if not api_key:
|
||||
logger.critical("Gemini API Key not found in environment variables.")
|
||||
# Fallback for local dev if absolutely necessary, but prefer env
|
||||
if file_path and os.path.exists(file_path):
|
||||
with open(file_path, "r") as f: return f.read().strip()
|
||||
raise ValueError("GEMINI_API_KEY not set")
|
||||
return api_key
|
||||
|
||||
def load_serp_api_key(file_path="serpapikey.txt"):
|
||||
"""Lädt den SerpAPI Key. Gibt None zurück, wenn nicht gefunden."""
|
||||
try:
|
||||
if os.path.exists(file_path):
|
||||
with open(file_path, "r") as f:
|
||||
return f.read().strip()
|
||||
# Fallback: Versuche Umgebungsvariable
|
||||
return os.environ.get("SERP_API_KEY")
|
||||
except Exception as e:
|
||||
logger.warning(f"Konnte SerpAPI Key nicht laden: {e}")
|
||||
def load_serp_api_key(file_path=None):
|
||||
"""Loads the SerpAPI Key from environment variables."""
|
||||
api_key = os.getenv("SERP_API_KEY")
|
||||
if not api_key:
|
||||
logger.warning("SerpAPI Key not found in environment variables.")
|
||||
return None
|
||||
return api_key
|
||||
|
||||
def get_website_text(url):
|
||||
# Auto-fix missing scheme
|
||||
|
||||
Reference in New Issue
Block a user