From b8584fec70bd6810fa2392deadc69595b3e94cfa Mon Sep 17 00:00:00 2001 From: Max Resnick Date: Sat, 4 May 2024 10:24:48 -0700 Subject: feat: refactor of repo management --- internal/admin/middleware.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'internal/admin/middleware.go') 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() + } }) } -- cgit v1.2.3