Add /api/v1/info for build info output.

This commit is contained in:
Stanislav Nikitin 2020-12-23 20:48:23 +05:00
parent 095e24a2b0
commit 08d5f36c36
Signed by: pztrn
GPG Key ID: 1E944A0F0568B550
1 changed files with 19 additions and 0 deletions

View File

@ -152,6 +152,25 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
_, _ = w.Write(appsList)
return
case "info":
infoData := struct {
Branch string
Build string
CommitHash string
Version string
}{
Branch: common.Branch,
Build: common.Build,
CommitHash: common.CommitHash,
Version: common.Version,
}
infoBytes, _ := json.Marshal(infoData)
w.WriteHeader(http.StatusOK)
_, _ = w.Write(infoBytes)
return
case "metrics":
handler, found := h.handlers[rInfo.Application]