Files
EpiSupport-Zammad-Scraper/app/config.py
T
leopold.stroblandClaude Opus 4.8 1041f283a4 Add EPI-Support monitoring & analytics platform
Internal Flask app that monitors the epi-helpdesk.zammad.com tickets via
the Zammad API, deployable as a systemd service behind Apache under
/episupport.

Features:
- Poller: session-login API sync, snapshot diff to detect agent changes
  (status, owner, priority, closures, new replies); email notifications
- Dashboard: ticket overview with sorting, "not closed" filter and
  highlighting of tickets with unconfirmed changes; per-item and bulk
  "mark as read"
- Analytics: KPIs, response/resolution times, monthly SVG trend chart,
  distributions (status/priority/group/agent), Excel export
- Conversation view: full per-ticket thread cached in the DB (avoids
  proxy timeouts), inline image attachments, safe HTML-to-text rendering
- Write actions: reply to tickets and create new tickets with a
  confirmation step and attachment upload (incl. clipboard paste);
  self-triggered actions are synced back so they aren't flagged as changes
- Local timezone display (Europe/Berlin) for all timestamps

Includes deploy tooling: setup.sh, systemd units and Apache config.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-01 09:19:53 +02:00

47 lines
1.6 KiB
Python

"""Zentrale Konfiguration, geladen aus der .env-Datei."""
import os
from pathlib import Path
from dotenv import load_dotenv
# Projektwurzel = ein Verzeichnis über diesem File
BASE_DIR = Path(__file__).resolve().parent.parent
load_dotenv(BASE_DIR / ".env")
DATA_DIR = BASE_DIR / "data"
DATA_DIR.mkdir(exist_ok=True)
DB_PATH = DATA_DIR / "episupport.db"
def _b(value: str, default: bool = False) -> bool:
if value is None:
return default
return value.strip().lower() in ("1", "true", "yes", "on", "ja")
# --- Zammad ---
ZAMMAD_URL = os.getenv("ZAMMAD_URL", "https://epi-helpdesk.zammad.com").rstrip("/")
ZAMMAD_TOKEN = os.getenv("ZAMMAD_TOKEN", "").strip()
ZAMMAD_USER = os.getenv("ZAMMAD_USER", "").strip()
ZAMMAD_PASSWORD = os.getenv("ZAMMAD_PASSWORD", "")
# --- Abruf ---
POLL_INTERVAL_SECONDS = int(os.getenv("POLL_INTERVAL_SECONDS", "180"))
# --- Web ---
URL_PREFIX = os.getenv("EPISUPPORT_URL_PREFIX", "/episupport").rstrip("/")
PORT = int(os.getenv("EPISUPPORT_PORT", "8071"))
# Zeitzone für die Anzeige (Zammad liefert UTC)
DISPLAY_TZ = os.getenv("DISPLAY_TZ", "Europe/Berlin")
# --- E-Mail ---
NOTIFY_ENABLED = _b(os.getenv("NOTIFY_ENABLED"), False)
SMTP_HOST = os.getenv("SMTP_HOST", "").strip()
SMTP_PORT = int(os.getenv("SMTP_PORT", "587"))
SMTP_USER = os.getenv("SMTP_USER", "").strip()
SMTP_PASSWORD = os.getenv("SMTP_PASSWORD", "")
SMTP_STARTTLS = _b(os.getenv("SMTP_STARTTLS"), True)
SMTP_SSL = _b(os.getenv("SMTP_SSL"), False) # True => SMTPS (Port 465)
SMTP_FROM = os.getenv("SMTP_FROM", "").strip()
NOTIFY_TO = [a.strip() for a in os.getenv("NOTIFY_TO", "").split(",") if a.strip()]