Skip to content

Commit

Permalink
Split SERVICE_HOST_OVERRIDE into host and port as separate vars
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Osmond committed Aug 3, 2018
1 parent fab995a commit 8e738cd
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lile.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,19 @@ 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")

var url string
port := "80"

if val, ok := os.LookupEnv("SERVICE_HOST_OVERRIDE"); ok {
url = val
}
if val, ok := os.LookupEnv("SERVICE_PORT_OVERRIDE"); ok {
port = val
}

if url != "" {
return fmt.Sprintf("%s:%s", url, port)
}

if service.Registry != nil {
Expand Down

0 comments on commit 8e738cd

Please sign in to comment.