package admin import ( "fmt" "net/http" ) // Hooks middleware to handle requests to the admin repo. func Hooks(adminSvc *Servicer, next http.Handler) http.Handler { repoUpdatePath := fmt.Sprintf("/%s/git-receive-pack", mgmtRepoName) return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { next.ServeHTTP(rw, req) if req.URL.Path == repoUpdatePath && req.Method == http.MethodPost { adminSvc.Reload() } }) }