MCPcopy Create free account
hub / github.com/eth-easl/dirigent / getRuntimeClient

Function getRuntimeClient

internal/data_plane/haproxy/connection.go:56–81  ·  view source on GitHub ↗
(configClient *configuration.Client)

Source from the content-addressed store, hash-verified

54}
55
56func getRuntimeClient(configClient *configuration.Client) *runtime.Client {
57 runtimeClient := &runtime.Client{}
58
59 _, globalConf, err := configClient.GetGlobalConfiguration("")
60 if err != nil {
61 logrus.Warn("Cannot read HAProxy runtime API configuration; resorting to default...")
62 return nil
63 }
64
65 if len(globalConf.RuntimeApis) != 0 {
66 socketList := make([]string, 0, 1)
67 for _, r := range globalConf.RuntimeApis {
68 socketList = append(socketList, *r.Address)
69 }
70
71 if err = runtimeClient.Init(socketList, "", 0); err != nil {
72 logrus.Warn("Error setting up HAProxy runtime client, not using one")
73 return nil
74 }
75 } else {
76 logrus.Warn("HAProxy runtime API not configured, not using it")
77 return nil
78 }
79
80 return runtimeClient
81}
82
83func getHAProxyClient() *clientnative.HAProxyClient {
84 client := &clientnative.HAProxyClient{}

Callers 1

getHAProxyClientFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected