feat: add web layer (internal/web) and wire it into main.go
Routing, html/template layout/content pattern, and the Pre-Publish check flow: POST /pruefen runs extraction (Stufe 1) then rules.Evaluate (Stufe 2) and renders the result as an htmx fragment. Nothing is persisted yet — that's the next step (wiring internal/store in). The needsClarification case is rendered explicitly as a request for more information rather than "no findings", matching the core principle. Every result carries the legal-advice disclaimer required by CLAUDE.md's guardrails. Server depends on a narrow Extractor interface rather than *extract. Client directly, so tests inject a fake instead of calling the real API — internal/web's test suite never touches the network. htmx is vendored locally (internal/web/static/htmx.min.js) instead of loaded from a CDN, keeping the UI usable without runtime internet access. cmd/deklarix/main.go now wires all of this together: reads ANTHROPIC_API_KEY (required) and RULES_DIR (default "rules"), builds the extract client and loads the rule set, and serves web.Server instead of the old inline health-only mux. This exposed the same crash-loop risk fixed earlier for DATABASE_URL: postinst's start guard only checked DATABASE_URL, so a fresh install would now crash-loop on a missing ANTHROPIC_API_KEY instead. The guard checks both. scripts/build.sh also now ships rules/*.yaml into the .deb under /usr/share/deklarix/rules (not a conffile — rules are updated via the release pipeline, never hand-edited on a server), and deklarix.env.example points RULES_DIR there by default. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -45,17 +45,19 @@ case "$1" in
|
||||
systemctl daemon-reload 2>/dev/null || true
|
||||
systemctl enable deklarix.service >/dev/null 2>&1 || true
|
||||
|
||||
# Nicht blind starten — ohne gesetzte DATABASE_URL würde der Dienst
|
||||
# nur in eine Restart-Schleife laufen (main.go bricht sonst bewusst
|
||||
# mit log.Fatal ab, siehe CLAUDE.md "keine stillen Fallbacks"). Die
|
||||
# Vorlage liefert DATABASE_URL auskommentiert aus — ein Treffer hier
|
||||
# bedeutet also wirklich "vom Admin gesetzt", nicht den Platzhalter.
|
||||
if grep -qE '^DATABASE_URL=.+' "$CONFIG_DIR/deklarix.env" 2>/dev/null; then
|
||||
# Nicht blind starten — ohne gesetzte DATABASE_URL/ANTHROPIC_API_KEY
|
||||
# würde der Dienst nur in eine Restart-Schleife laufen (main.go
|
||||
# bricht sonst bewusst mit log.Fatal ab, siehe CLAUDE.md "keine
|
||||
# stillen Fallbacks"). Die Vorlage liefert beide auskommentiert aus —
|
||||
# ein Treffer hier bedeutet also wirklich "vom Admin gesetzt", nicht
|
||||
# den Platzhalter.
|
||||
if grep -qE '^DATABASE_URL=.+' "$CONFIG_DIR/deklarix.env" 2>/dev/null \
|
||||
&& grep -qE '^ANTHROPIC_API_KEY=.+' "$CONFIG_DIR/deklarix.env" 2>/dev/null; then
|
||||
systemctl restart deklarix.service
|
||||
else
|
||||
echo ""
|
||||
echo " → Deklarix installiert, aber noch nicht gestartet."
|
||||
echo " DATABASE_URL in $CONFIG_DIR/deklarix.env setzen, dann:"
|
||||
echo " DATABASE_URL und ANTHROPIC_API_KEY in $CONFIG_DIR/deklarix.env setzen, dann:"
|
||||
echo " systemctl start deklarix"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user