diff options
Diffstat (limited to 'internal/admin/middleware.go')
| -rw-r--r-- | internal/admin/middleware.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/internal/admin/middleware.go b/internal/admin/middleware.go index 8b88c83..0dcf558 100644 --- a/internal/admin/middleware.go +++ b/internal/admin/middleware.go @@ -1,13 +1,17 @@ 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) { - go adminSvc.Reload() next.ServeHTTP(rw, req) + if req.URL.Path == repoUpdatePath && req.Method == http.MethodPost { + adminSvc.Reload() + } }) } |