package admin import ( "log/slog" "net/http" ) // Hooks middleware to handle requests to the admin repo. func Hooks(adminSvc *Servicer, next http.Handler) http.Handler { repoUpdatePath := "/mgmt/git-receive-pack" return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { next.ServeHTTP(rw, req) slog.Debug("hooks middleware", "url", req.URL.Path) if req.URL.Path == repoUpdatePath && req.Method == http.MethodPost { slog.Debug("hook firing reload") go adminSvc.Reload() } }) }