From e5ded7bcd796a1919eb1a367026fd868be020568 Mon Sep 17 00:00:00 2001 From: Homelab Cursor Date: Sat, 21 Mar 2026 20:25:58 +0100 Subject: [PATCH] refactor: Credentials aus homelab.conf laden statt hardcoded WP_PASS, OPENROUTER_KEY, TELEGRAM_TOKEN werden jetzt zentral aus homelab.conf gelesen - kein manuelles Update bei Key-Rotation noetig --- arakava-news/reddit_trends.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/arakava-news/reddit_trends.py b/arakava-news/reddit_trends.py index 198c1cea..4de890eb 100644 --- a/arakava-news/reddit_trends.py +++ b/arakava-news/reddit_trends.py @@ -11,13 +11,30 @@ import logging import os import re from datetime import datetime, timedelta, timezone +from pathlib import Path + +def _load_homelab_conf(): + """Liest Schluessel-Wert-Paare aus homelab.conf.""" + conf = {} + for path in ["/opt/homelab-brain/homelab.conf", "/opt/homelab-ai-bot/../homelab.conf"]: + p = Path(path) + if p.exists(): + for line in p.read_text().splitlines(): + line = line.strip() + if "=" in line and not line.startswith("#"): + k, _, v = line.partition("=") + conf[k.strip()] = v.strip().strip('"') + break + return conf + +_CONF = _load_homelab_conf() # ── Konfiguration ────────────────────────────────────────────── WP_URL = "https://arakava-news-2.orbitalo.net" WP_USER = "admin" -WP_PASS = "eJIyhW0p5PFacjvvKGufKeXS" -OPENROUTER_KEY = "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" -TELEGRAM_TOKEN = "8551565940:AAHIUpZND-tCNGv9yEoNPRyPt4GxEPYBJdE" +WP_PASS = _CONF.get("PW_WP_ADMIN", "") +OPENROUTER_KEY = _CONF.get("OPENROUTER_KEY", "") +TELEGRAM_TOKEN = _CONF.get("TG_MUTTER_TOKEN", "") TELEGRAM_CHAT = "674951792" LOG_FILE = "/opt/rss-manager/logs/reddit_trends.log" WP_CATEGORY = "Tech-Trends"