Fix client web démarre sans API server accessible
Ajouter apiClient.GetV4() comme health check du API server
This commit is contained in:
parent
3e42ac0454
commit
942b69407d
2 changed files with 50 additions and 6 deletions
|
@ -6,7 +6,9 @@ import (
|
|||
"fmt"
|
||||
"html/template"
|
||||
"io"
|
||||
"log"
|
||||
|
||||
"git.agecem.com/agecem/bottin/v4/data"
|
||||
"git.agecem.com/agecem/bottin/v4/web"
|
||||
"git.agecem.com/agecem/bottin/v4/web/webhandlers"
|
||||
"github.com/labstack/echo/v4"
|
||||
|
@ -16,12 +18,13 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
webUser string
|
||||
webPassword string
|
||||
webPort int
|
||||
webApiHost string
|
||||
webApiKey string
|
||||
webApiPort int
|
||||
webUser string
|
||||
webPassword string
|
||||
webPort int
|
||||
webApiHost string
|
||||
webApiKey string
|
||||
webApiPort int
|
||||
webApiProtocol string
|
||||
)
|
||||
|
||||
var templatesFS embed.FS
|
||||
|
@ -43,10 +46,22 @@ var webCmd = &cobra.Command{
|
|||
webApiHost = viper.GetString("web.api.host")
|
||||
webApiKey = viper.GetString("web.api.key")
|
||||
webApiPort = viper.GetInt("web.api.port")
|
||||
webApiProtocol = viper.GetString("web.api.protocol")
|
||||
webPassword = viper.GetString("web.password")
|
||||
webPort = viper.GetInt("web.port")
|
||||
webUser = viper.GetString("web.user")
|
||||
|
||||
// Ping API server
|
||||
|
||||
apiClient := data.NewApiClient(webApiKey, webApiHost, webApiProtocol, webApiPort)
|
||||
|
||||
pingResult, err := apiClient.GetV4()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
log.Println(pingResult)
|
||||
|
||||
e := echo.New()
|
||||
|
||||
// Middlewares
|
||||
|
|
Reference in a new issue