DMS-Modul-Grundgerüst als Unterordner im bestehenden nexarch-Monorepo (dms/), eigenes Go-Modul (gitea.perlbach24.de/scripte/nexarch/dms), getrennt von Core. App/Worker-Trennung nach paperless-ngx-Vorbild (lange Aufgaben blockieren nie eine Anfrage): cmd/app (HTTP, /healthz), cmd/worker (Hintergrund-Dienst-Stub), internal/shared. golangci-lint (govet/staticcheck/errcheck/unused/ineffassign/gofmt/ goimports) + Makefile-Targets (install/run/lint/fmt/test). Auf 192.168.1.131 verifiziert: build/fmt/lint/test clean, absichtlich eingefuegter Lint-Verstoss bricht den Build wie gefordert ab (Exit 2), make run startet App+Worker und /healthz antwortet innerhalb 2s. Siehe dms/docs/FDN-01-PRUEFPROTOKOLL.md fuer alle Pruefungsergebnisse. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HhgFcLS8tYMhDJpP74C6AQ
31 lines
842 B
Go
31 lines
842 B
Go
// app ist der Anfrage-Dienst (Request-Path) des DMS — getrennt vom Worker,
|
|
// damit lange Hintergrundaufgaben nie eine HTTP-Anfrage blockieren
|
|
// (Akzeptanzkriterium/Produkt-DNA: paperless-ngx-Trennung Dienst/Worker).
|
|
package main
|
|
|
|
import (
|
|
"log"
|
|
"net/http"
|
|
"os"
|
|
|
|
"gitea.perlbach24.de/scripte/nexarch/dms/internal/shared"
|
|
)
|
|
|
|
func main() {
|
|
addr := os.Getenv("NEXARCH_DMS_APP_LISTEN_ADDR")
|
|
if addr == "" {
|
|
addr = ":8090"
|
|
}
|
|
|
|
mux := http.NewServeMux()
|
|
mux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Content-Type", "application/json")
|
|
_, _ = w.Write([]byte(`{"status":"ok","service":"dms-app","version":"` + shared.Version + `"}`))
|
|
})
|
|
|
|
log.Printf("dms-app hoert auf %s (version %s)", addr, shared.Version)
|
|
if err := http.ListenAndServe(addr, mux); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|