add https prefix when using tls config for etcd
This commit is contained in:
parent
ac1aace214
commit
124b1bd7b7
@ -107,6 +107,15 @@ func configure(e *etcdRegistry, opts ...registry.Option) error {
|
|||||||
config.Endpoints = cAddrs
|
config.Endpoints = cAddrs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if the endpoints have https://
|
||||||
|
if config.TLS != nil {
|
||||||
|
for i, ep := range config.Endpoints {
|
||||||
|
if !strings.HasPrefix(ep, "https://") {
|
||||||
|
config.Endpoints[i] = "https://" + ep
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cli, err := clientv3.New(config)
|
cli, err := clientv3.New(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user