Skip to content

Commit

Permalink
Merge pull request lileio#53 from echo-health/master
Browse files Browse the repository at this point in the history
Split SERVICE_HOST_OVERRIDE into host and port as separate vars
  • Loading branch information
arbarlow authored Aug 6, 2018
2 parents fab995a + 1e6718c commit d34107c
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down

0 comments on commit d34107c

Please sign in to comment.