add owner handle

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-06-14 13:40:51 +02:00
commit f862abe5a4
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
12 changed files with 274 additions and 55 deletions

View file

@ -5,6 +5,7 @@ import (
"log/slog"
"net/http"
"git.g3e.fr/H6N/account/internal/auth"
"git.g3e.fr/H6N/account/internal/config"
"git.g3e.fr/H6N/account/internal/handler"
"git.g3e.fr/H6N/account/internal/snapshot"
@ -31,7 +32,12 @@ func New(cfg *config.Config, pool *pgxpool.Pool, logger *slog.Logger) *Server {
}
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
s.mux.ServeHTTP(w, r)
// /health est exempt d'auth. Toutes les autres routes passent par le middleware owner.
if r.URL.Path == "/health" {
s.mux.ServeHTTP(w, r)
return
}
auth.Middleware(s.mux).ServeHTTP(w, r)
}
func (s *Server) routes() {