1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-07-02 16:38:37 +00:00

Add option to enable maintenance mode

This commit is contained in:
Frédéric Guillot 2020-09-12 18:31:45 -07:00
parent a8de067810
commit df7a6e18fd
5 changed files with 37 additions and 1 deletions

View file

@ -169,6 +169,14 @@ func setupHandler(store *storage.Storage, feedHandler *feed.Handler, pool *worke
router = router.PathPrefix(config.Opts.BasePath()).Subrouter()
}
if config.Opts.HasMaintenanceMode() {
router.Use(func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(config.Opts.MaintenanceMessage()))
})
})
}
router.Use(middleware)
fever.Serve(router, store)