aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/middleware.go
blob: 60274ad22d3f2dfebd864f3e6c33a4a66c12f21e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package admin

import (
	"log"
	"net/http"
)

// Hooks middleware to handle requests to the admin repo.
func Hooks(adminSvc *Servicer, next http.Handler) http.Handler {
	return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
		log.Printf("stuffs about to reload %s", "now")
		next.ServeHTTP(rw, req)
		go adminSvc.Reload()
	})
}