Some checks failed
Deploy Production / Deploy to Staging (push) Has been skipped
Go Linter / Run golangci-lint (api_gateway) (push) Failing after 2m31s
Go Linter / Build golang services (api_gateway) (push) Has been skipped
Go Linter / Tag Commit (push) Has been skipped
Go Linter / Push Docker Images (api_gateway) (push) Has been skipped
35 lines
956 B
Go
35 lines
956 B
Go
package http_router
|
||
|
||
import (
|
||
"encoding/json"
|
||
"net/http"
|
||
)
|
||
|
||
// @Summary Получить информацию о сборке
|
||
// @Description Получение информации о версии, коммите и дате сборки приложения
|
||
// @Tags system
|
||
// @Accept json
|
||
// @Produce json
|
||
// @Success 200 {object} map[string]string "Информация о сборке"
|
||
// @Router /api/v1/healthcheck [get]
|
||
func (h *handler) getBuildInfoHandler(w http.ResponseWriter, _ *http.Request) {
|
||
response := struct {
|
||
Version string `json:"version"`
|
||
Commit string `json:"commit"`
|
||
Date string `json:"date"`
|
||
}{
|
||
Version: h.buildConfig.Version,
|
||
Commit: h.buildConfig.Commit,
|
||
Date: h.buildConfig.Date,
|
||
}
|
||
|
||
responseJSON, err := json.Marshal(response)
|
||
if err != nil {
|
||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||
return
|
||
}
|
||
|
||
w.Header().Set("Content-Type", "application/json")
|
||
_, _ = w.Write(responseJSON)
|
||
}
|