Skip to content

Commit

Permalink
Merge pull request #8 from ankitsridhar16/feat/version-endpoint
Browse files Browse the repository at this point in the history
feat: added version endpoint to check vince version
  • Loading branch information
gernest authored Apr 6, 2024
2 parents 9ebf0cc + efa7625 commit 15c32f2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 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,17 @@ 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
}

s.write(w, &v1.Version{
Version: version.VERSION,
})
}

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

0 comments on commit 15c32f2

Please sign in to comment.