CI / Web-Barrierefreiheitspruefung (axe, Tastatur, Reflow, Textabstaende) (pull_request) Canceled after 0s
CI / Core-Modul (Build/Vet/Test) (pull_request) Failing after 1m0s
CI / DMS Security-Test-Gate (AC5, Merge-Gate) (pull_request) Successful in 5s
CI / Connect Security-Test-Gate (QA-01 AC4, Merge-Gate) (pull_request) Successful in 4s
CI / DMS-Modul Supply-Chain-Scan (govulncheck) (pull_request) Failing after 21s
CI / Web (dms-browser) (pull_request) Failing after 1m27s
CI / Web (pdf-viewer) (pull_request) Failing after 1m2s
CI / Web (shl) (pull_request) Failing after 11s
CI / Core-Modul (Build/Vet/Test) (push) Failing after 1m0s
CI / DMS Security-Test-Gate (AC5, Merge-Gate) (push) Successful in 5s
CI / Connect Security-Test-Gate (QA-01 AC4, Merge-Gate) (push) Successful in 4s
CI / DMS-Modul Supply-Chain-Scan (govulncheck) (push) Failing after 19s
CI / Web (dms-browser) (push) Failing after 1m26s
CI / Web (pdf-viewer) (push) Failing after 1m3s
CI / Web (shl) (push) Failing after 11s
Core-Schnittstellen-Vertragstests / contract-tests (pull_request) Successful in 13m12s
CI / DMS-Modul (Lint/Build/Test/Coverage/Artefakt) (pull_request) Canceled after 0s
CI / DMS-Modul (Lint/Build/Test/Coverage/Artefakt) (push) Canceled after 0s
CI / Web-Barrierefreiheitspruefung (axe, Tastatur, Reflow, Textabstaende) (push) Canceled after 0s
DB-Integrationstests / db-tests (pull_request) Canceled after 0s
Supply-Chain-Scan (Go) / govulncheck (push) Canceled after 0s
Supply-Chain-Scan (Go) / govulncheck (pull_request) Canceled after 0s
Supply-Chain-Scan (npm) / npm-audit (pull_request) Canceled after 0s
Core-Pflichttest-Gate / pflichttest-gate (pull_request) Canceled after 0s
RBAC-Rollenhierarchie-Pflichtgate / rbac-policy-invariant (pull_request) Canceled after 0s
Core-Schnittstellen-Vertragstests / contract-tests (push) Successful in 12m23s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
54 lines
1.5 KiB
Go
54 lines
1.5 KiB
Go
// notify-api ist der Aufrufpunkt fuer CFG-05: stellt Core CFG-04s
|
|
// EnqueueIfAllowed als HTTP-Endpunkt fuer andere, physisch getrennte
|
|
// Module (Archive, DMS, Mail) bereit. Getrennt von cmd/core aus
|
|
// demselben Grund wie policy-api (RBAC-06).
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"log"
|
|
"net/http"
|
|
"os"
|
|
|
|
"github.com/jackc/pgx/v5/pgxpool"
|
|
|
|
"gitea.perlbach24.de/scripte/nexarch/common/httpharden"
|
|
"gitea.perlbach24.de/scripte/nexarch/internal/notify"
|
|
"gitea.perlbach24.de/scripte/nexarch/internal/notifyapi"
|
|
"gitea.perlbach24.de/scripte/nexarch/internal/notifyprefs"
|
|
)
|
|
|
|
func main() {
|
|
dsn := os.Getenv("NEXARCH_NOTIFY_ADMIN_DSN")
|
|
if dsn == "" {
|
|
log.Fatal("NEXARCH_NOTIFY_ADMIN_DSN muss gesetzt sein")
|
|
}
|
|
serviceToken := os.Getenv("NEXARCH_NOTIFY_SERVICE_TOKEN")
|
|
if serviceToken == "" {
|
|
log.Fatal("NEXARCH_NOTIFY_SERVICE_TOKEN muss gesetzt sein")
|
|
}
|
|
addr := os.Getenv("NEXARCH_NOTIFY_API_LISTEN_ADDR")
|
|
if addr == "" {
|
|
addr = "127.0.0.1:8094"
|
|
}
|
|
|
|
ctx := context.Background()
|
|
pool, err := pgxpool.New(ctx, dsn)
|
|
if err != nil {
|
|
log.Fatalf("datenbankverbindung: %v", err)
|
|
}
|
|
defer pool.Close()
|
|
|
|
prefs := notifyprefs.NewStore(pool)
|
|
dispatcher := notify.NewDispatcher(pool)
|
|
|
|
mux := http.NewServeMux()
|
|
notifyapi.Mount(mux, prefs, dispatcher, serviceToken)
|
|
mux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) })
|
|
|
|
log.Printf("notify-api: listening on %s", addr)
|
|
if err := httpharden.ListenAndServe(addr, mux); err != nil {
|
|
log.Fatalf("http server: %v", err)
|
|
}
|
|
}
|