From f7cbd3e4387079640001c5d85e2c0bca9019fc79 Mon Sep 17 00:00:00 2001 From: "Kravchuk S.V" Date: Thu, 4 Aug 2016 01:30:40 +0300 Subject: [PATCH] fix service ip and port in consul interpolateService fix service ip and port in consul interpolateService --- consul/consul.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/consul/consul.go b/consul/consul.go index 1f75a8ffb..b868379e2 100644 --- a/consul/consul.go +++ b/consul/consul.go @@ -5,6 +5,7 @@ import ( "log" "net/url" "strings" + "strconv" "os" "github.com/gliderlabs/registrator/bridge" consulapi "github.com/hashicorp/consul/api" @@ -21,8 +22,8 @@ func init() { } func (r *ConsulAdapter) interpolateService(script string, service *bridge.Service) string { - withIp := strings.Replace(script, "$SERVICE_IP", service.Origin.HostIP, -1) - withPort := strings.Replace(withIp, "$SERVICE_PORT", service.Origin.HostPort, -1) + withIp := strings.Replace(script, "$SERVICE_IP", service.IP, -1) + withPort := strings.Replace(withIp, "$SERVICE_PORT", strconv.Itoa(service.Port), -1) return withPort }