add PING handler to dashboard API
This commit is contained in:
parent
1de21c86ae
commit
d35c6e77d7
2 changed files with 26 additions and 0 deletions
6
web.go
6
web.go
|
@ -52,6 +52,8 @@ func (provider *WebProvider) Provide(configurationChan chan<- types.ConfigMessag
|
|||
// health route
|
||||
systemRouter.Methods("GET").Path("/health").HandlerFunc(provider.getHealthHandler)
|
||||
|
||||
// ping route
|
||||
systemRouter.Methods("GET").Path("/ping").HandlerFunc(provider.getPingHandler)
|
||||
// API routes
|
||||
systemRouter.Methods("GET").Path("/api").HandlerFunc(provider.getConfigHandler)
|
||||
systemRouter.Methods("GET").Path("/api/providers").HandlerFunc(provider.getConfigHandler)
|
||||
|
@ -120,6 +122,10 @@ func (provider *WebProvider) getHealthHandler(response http.ResponseWriter, requ
|
|||
templatesRenderer.JSON(response, http.StatusOK, metrics.Data())
|
||||
}
|
||||
|
||||
func (provider *WebProvider) getPingHandler(response http.ResponseWriter, request *http.Request) {
|
||||
fmt.Fprintf(response, "OK")
|
||||
}
|
||||
|
||||
func (provider *WebProvider) getConfigHandler(response http.ResponseWriter, request *http.Request) {
|
||||
currentConfigurations := provider.server.currentConfigurations.Get().(configs)
|
||||
templatesRenderer.JSON(response, http.StatusOK, currentConfigurations)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue