Bugfix: Set gateway to node.Address

gw has not been initialized; it was basically an empty string and only
got populated by Sprintf-ing the addr:port IF the port has been set.
This commit sets the gw to node.Address to it's never an empty string.
This commit is contained in:
Milos Gajdos 2019-06-26 16:28:33 +01:00
parent 27b145f968
commit 76011b151d
No known key found for this signature in database
GPG Key ID: 8B31058CC55DFD4F

View File

@ -108,7 +108,7 @@ func (r *router) addServiceRoutes(reg registry.Registry, network string, metric
// add each service node as a separate route;
for _, service := range services {
for _, node := range service.Nodes {
var gw string
gw := node.Address
if node.Port > 0 {
gw = fmt.Sprintf("%s:%d", node.Address, node.Port)
}