add owner handle
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
0f2d7126eb
commit
f862abe5a4
12 changed files with 274 additions and 55 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue