Add service name to version response (#241)
Signed-off-by: Dušan Borovčanin <borovcanindusan1@gmail.com>
This commit is contained in:
parent
2dc7f3eea1
commit
789963447a
|
@ -41,7 +41,7 @@ func MakeHandler(svc mainflux.MessagePublisher, mc manager.ManagerClient) http.H
|
|||
opts...,
|
||||
))
|
||||
|
||||
r.GetFunc("/version", mainflux.Version())
|
||||
r.GetFunc("/version", mainflux.Version("http"))
|
||||
r.Handle("/metrics", promhttp.Handler())
|
||||
|
||||
return r
|
||||
|
|
|
@ -143,7 +143,7 @@ func MakeHandler(svc manager.Service) http.Handler {
|
|||
opts...,
|
||||
))
|
||||
|
||||
r.GetFunc("/version", mainflux.Version())
|
||||
r.GetFunc("/version", mainflux.Version("manager"))
|
||||
r.Handle("/metrics", promhttp.Handler())
|
||||
|
||||
return r
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
// MakeHandler returns a HTTP handler for API endpoints.
|
||||
func MakeHandler() http.Handler {
|
||||
r := bone.New()
|
||||
r.GetFunc("/version", mainflux.Version())
|
||||
r.GetFunc("/version", mainflux.Version("normalizer"))
|
||||
r.Handle("/metrics", promhttp.Handler())
|
||||
|
||||
return r
|
||||
|
|
|
@ -9,12 +9,13 @@ const version string = "0.2.2"
|
|||
|
||||
type response struct {
|
||||
Version string
|
||||
Service string
|
||||
}
|
||||
|
||||
// Version exposes an HTTP handler for retrieving service version.
|
||||
func Version() http.HandlerFunc {
|
||||
func Version(service string) http.HandlerFunc {
|
||||
return http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) {
|
||||
res := response{Version: version}
|
||||
res := response{Version: version, Service: service}
|
||||
|
||||
data, _ := json.Marshal(res)
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ func MakeHandler(svc ws.Service, mc manager.ManagerClient, l log.Logger) http.Ha
|
|||
|
||||
mux := bone.New()
|
||||
mux.GetFunc("/channels/:id/messages", handshake(svc))
|
||||
mux.GetFunc("/version", mainflux.Version())
|
||||
mux.GetFunc("/version", mainflux.Version("websocket"))
|
||||
mux.Handle("/metrics", promhttp.Handler())
|
||||
|
||||
return mux
|
||||
|
|
Loading…
Reference in New Issue