This repository has been archived on 2026-07-22. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
mission-control/config.py
T
Hitonabi 70c7cba613 v3: Mission Control Self-Update + Guides-Copy + Button-Audit
- Neuer Self-Update-Button ("Mission Control aktualisieren"): POST /api/self-update
  macht git pull (Quelle) -> rsync nach Prod -> systemctl restart (NOPASSWD).
  Pfade aus config.py (SOURCE_DIR/PROD_DIR), nicht user-hartkodiert.
- "LLM-Engine aktualisieren" ehrlich (war MC, ist llama.cpp via MC_UPDATE_CMD).
- Guides: Kopier-Buttons fuer alle Configs + Codeblock (Copy-Paste-tauglich).
- Button-Audit: Funktionen/Labels in allen Panels geprueft, stimmig.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 12:57:13 +02:00

39 lines
1.7 KiB
Python

"""
Zentrale Konfiguration fuer Mission Control.
Alles ueber Umgebungsvariablen ueberschreibbar. Wird von allen Modulen importiert,
damit es genau eine Quelle der Wahrheit fuer Pfade, URLs und Defaults gibt.
"""
import os
from pathlib import Path
from ruamel.yaml import YAML
# ---------------------------------------------------------------------------
# Env-Vars (siehe README fuer Bedeutung)
# ---------------------------------------------------------------------------
LLAMA_SWAP_URL = os.environ.get("MC_LLAMA_SWAP_URL", "http://127.0.0.1:8080").rstrip("/")
CONFIG_PATH = Path(os.environ.get("MC_CONFIG_PATH", "/etc/llama-swap/config.yaml"))
MODELS_DIR = Path(os.environ.get("MC_MODELS_DIR", "/srv/models"))
# Befehl, der zum Starten eines Modells in die config.yaml geschrieben wird.
# {model} = Pfad zur GGUF-Datei, {ctx} = Kontextlaenge, ${PORT} bleibt fuer llama-swap stehen.
# WICHTIG: an deinen Container-/llama-server-Aufruf anpassen (siehe README).
CMD_TEMPLATE = os.environ.get(
"MC_CMD_TEMPLATE",
"llama-server -m {model} --host 127.0.0.1 --port ${PORT} "
"-c {ctx} -ngl 999 -fa 1 --no-mmap",
)
# Befehl fuer "Container/Toolbox aktualisieren". Standard: kyuz0 refresh-Skript.
UPDATE_CMD = os.environ.get("MC_UPDATE_CMD", "")
DEFAULT_TTL = int(os.environ.get("MC_DEFAULT_TTL", "300"))
TOKEN = os.environ.get("MC_TOKEN", "") # leer = keine Auth (nur LAN!)
# Self-Update ("Mission Control aktualisieren"): Quelle = git-Repo, Prod = laufende Installation.
SOURCE_DIR = os.path.expanduser(os.environ.get("MC_SOURCE_DIR", "~/mission-control"))
PROD_DIR = str(Path(__file__).resolve().parent)
# Gemeinsame YAML-Instanz (preserve_quotes haelt Kommentare/Quotes in config.yaml).
yaml = YAML()
yaml.preserve_quotes = True