Skip to content

Commit

Permalink
feat: added version endpoint to check vince version
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitsridhar16 committed Apr 6, 2024
1 parent 9ebf0cc commit b70bd2f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions internal/cluster/http/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request) {
s.handleReady(w, r, params)
case r.URL.Path == "/metrics":
s.metrics.ServeHTTP(w, r)
case r.URL.Path == "/version":
s.handleVersion(w, r)
default:
w.WriteHeader(http.StatusNotFound)
}
Expand Down Expand Up @@ -985,6 +987,16 @@ func (s *Service) handleReady(w http.ResponseWriter, r *http.Request, params Que

}

func (s *Service) handleVersion(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodGet {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}

w.WriteHeader(http.StatusOK)
w.Write([]byte(`{"version": "` + version.VERSION + `"}`))
}

func (s *Service) status() *v1.Status {
return &v1.Status{
Os: s.osStatus(),
Expand Down

0 comments on commit b70bd2f

Please sign in to comment.