[BREAKING] Déplacer route /v4 vers /v4/health #12
1 changed files with 10 additions and 0 deletions
|
@ -9,6 +9,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"git.agecem.com/agecem/bottin/v4/models"
|
"git.agecem.com/agecem/bottin/v4/models"
|
||||||
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ApiClient struct {
|
type ApiClient struct {
|
||||||
|
@ -18,6 +19,15 @@ type ApiClient struct {
|
||||||
Protocol string
|
Protocol string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NewApiClientFromViper() *ApiClient {
|
||||||
|
apiClientKey := viper.GetString("web.api.key")
|
||||||
|
apiClientHost := viper.GetString("web.api.host")
|
||||||
|
apiClientProtocol := viper.GetString("web.api.protocol")
|
||||||
|
apiClientPort := viper.GetInt("web.api.port")
|
||||||
|
|
||||||
|
return NewApiClient(apiClientKey, apiClientHost, apiClientProtocol, apiClientPort)
|
||||||
|
}
|
||||||
|
|
||||||
func NewApiClient(key, host, protocol string, port int) *ApiClient {
|
func NewApiClient(key, host, protocol string, port int) *ApiClient {
|
||||||
return &ApiClient{
|
return &ApiClient{
|
||||||
Key: key,
|
Key: key,
|
||||||
|
|
Loading…
Reference in a new issue