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
This commit is contained in:
parent
0f61c54dfc
commit
e5ded7bcd7
1 changed files with 20 additions and 3 deletions
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue