package handlers import ( "net/http" bottindata "git.agecem.com/agecem/bottin/v5/data" "github.com/labstack/echo/v4" "github.com/spf13/viper" ) func GetHealth(c echo.Context) error { bottinApiKey := viper.GetString("bottin.api.key") bottinApiHost := viper.GetString("bottin.api.host") bottinApiProtocol := viper.GetString("bottin.api.protocol") bottinApiPort := viper.GetInt("bottin.api.port") bottinConnection := bottindata.NewApiClient( bottinApiKey, bottinApiHost, bottinApiProtocol, bottinApiPort, ) var bottinStatus string healthResponse, err := bottinConnection.GetHealth() if err != nil { bottinStatus = err.Error() } else { bottinStatus = healthResponse } return c.JSON(http.StatusOK, map[string]string{ "message": "Bottin-agenda API v2 is ready", "bottin": bottinStatus, }) }