Add AI service API token auth
All checks were successful
CI / test (push) Successful in 15s
Build and Deploy / build-and-deploy (push) Successful in 23s

This commit is contained in:
Grendgi
2026-06-08 14:16:24 +03:00
parent eb59298135
commit 038ad8d7cf
6 changed files with 89 additions and 0 deletions

View File

@@ -29,6 +29,10 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if path == "" {
path = "/"
}
if !s.requireAPIToken(path, r) {
writeError(w, http.StatusUnauthorized, "unauthorized")
return
}
switch {
case r.Method == http.MethodGet && path == "/healthz":
writeJSON(w, http.StatusOK, map[string]string{"status": "ok"})