add https prefix when using tls config for etcd

This commit is contained in:
Asim Aslam 2020-08-07 22:46:05 +01:00
parent ac1aace214
commit 124b1bd7b7

View File

@ -107,6 +107,15 @@ func configure(e *etcdRegistry, opts ...registry.Option) error {
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)
if err != nil {
return err