diff options
| author | Max Resnick <max@ofmax.li> | 2024-05-04 10:24:48 -0700 |
|---|---|---|
| committer | Max Resnick <max@ofmax.li> | 2024-05-20 21:33:57 -0700 |
| commit | b8584fec70bd6810fa2392deadc69595b3e94cfa (patch) | |
| tree | 2c2b17e06f780ad7d6ba46a0189f4faf45629fcb /internal/admin/middleware.go | |
| parent | 11fe503d5ea17fa3ddc4ce2308ea82b6edc7763e (diff) | |
| download | go-git-server-b8584fec70bd6810fa2392deadc69595b3e94cfa.tar.gz | |
feat: refactor of repo management
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() + } }) } |