diff --git a/lile.go b/lile.go index 665f6c6..634792c 100644 --- a/lile.go +++ b/lile.go @@ -113,8 +113,15 @@ func AddStreamInterceptor(sint grpc.StreamServerInterceptor) { // URLForService returns a service URL via a registry or a simple DNS name // if not available via the registry func URLForService(name string) string { - if os.Getenv("SERVICE_HOST_OVERRIDE") != "" { - return os.Getenv("SERVICE_HOST_OVERRIDE") + + host := name + port := "80" + + if val, ok := os.LookupEnv("SERVICE_HOST_OVERRIDE"); ok { + host = val + } + if val, ok := os.LookupEnv("SERVICE_PORT_OVERRIDE"); ok { + port = val } if service.Registry != nil { @@ -125,7 +132,8 @@ func URLForService(name string) string { return url } - return name + ":80" + return fmt.Sprintf("%s:%s", host, port) + } // ContextClientInterceptor passes around headers for tracing and linkerd