Fix empty address for registering service without IP
This commit is contained in:
parent
ca1d980746
commit
2ee2e29262
3 changed files with 45 additions and 1 deletions
|
@ -163,6 +163,10 @@ func (p *Provider) addServerTCP(ctx context.Context, item itemData, loadBalancer
|
|||
return errors.New("port is missing")
|
||||
}
|
||||
|
||||
if item.Address == "" {
|
||||
return errors.New("address is missing")
|
||||
}
|
||||
|
||||
loadBalancer.Servers[0].Address = net.JoinHostPort(item.Address, port)
|
||||
return nil
|
||||
}
|
||||
|
@ -193,6 +197,10 @@ func (p *Provider) addServer(ctx context.Context, item itemData, loadBalancer *d
|
|||
return errors.New("port is missing")
|
||||
}
|
||||
|
||||
if item.Address == "" {
|
||||
return errors.New("address is missing")
|
||||
}
|
||||
|
||||
loadBalancer.Servers[0].URL = fmt.Sprintf("%s://%s", loadBalancer.Servers[0].Scheme, net.JoinHostPort(item.Address, port))
|
||||
loadBalancer.Servers[0].Scheme = ""
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue