Skip to content

Commit

Permalink
server: handle nil maintenance service
Browse files Browse the repository at this point in the history
  • Loading branch information
janos committed Oct 2, 2019
1 parent 63560e0 commit 21e0b08
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions server/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@ func newInternalRouter(s *Server) http.Handler {
jsonresponse.NotFound(w, nil)
}))
internalAPIRouter.Handle("/api/status", http.HandlerFunc(s.statusAPIHandler))
internalAPIRouter.Handle("/api/maintenance", jsonMethodHandler{
"GET": http.HandlerFunc(s.maintenanceService.StatusHandler),
"POST": http.HandlerFunc(s.maintenanceService.OnHandler),
"DELETE": http.HandlerFunc(s.maintenanceService.OffHandler),
})
if s.maintenanceService != nil {
internalAPIRouter.Handle("/api/maintenance", jsonMethodHandler{
"GET": http.HandlerFunc(s.maintenanceService.StatusHandler),
"POST": http.HandlerFunc(s.maintenanceService.OnHandler),
"DELETE": http.HandlerFunc(s.maintenanceService.OffHandler),
})
}
internalBaseRouter.Handle("/metrics", promhttp.InstrumentMetricHandler(
s.metricsRegistry,
promhttp.HandlerFor(s.metricsRegistry, promhttp.HandlerOpts{}),
Expand Down

0 comments on commit 21e0b08

Please sign in to comment.