Skip to content

Commit

Permalink
config: let registry.consul.register.addr default to ui.addr
Browse files Browse the repository at this point in the history
Always set registry.consul.register.addr to the value of ui.addr if the
flag hasn't been specified.

Signed-off-by: Peter Schultz <peter.schultz@classmarkets.com>
  • Loading branch information
pschultz committed May 16, 2019
1 parent 86dde1c commit a7ea05c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion config/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func load(cmdline, environ, envprefix []string, props *properties.Properties) (c
f.StringVar(&cfg.Registry.Consul.TLS.CAPath, "registry.consul.tls.capath", defaultConfig.Registry.Consul.TLS.CAPath, "path to consul CA directory")
f.BoolVar(&cfg.Registry.Consul.TLS.InsecureSkipVerify, "registry.consul.tls.insecureskipverify", defaultConfig.Registry.Consul.TLS.InsecureSkipVerify, "is tls check enabled")
f.BoolVar(&cfg.Registry.Consul.Register, "registry.consul.register.enabled", defaultConfig.Registry.Consul.Register, "register fabio in consul")
f.StringVar(&cfg.Registry.Consul.ServiceAddr, "registry.consul.register.addr", defaultConfig.Registry.Consul.ServiceAddr, "service registration address")
f.StringVar(&cfg.Registry.Consul.ServiceAddr, "registry.consul.register.addr", "<ui.addr>", "service registration address")
f.StringVar(&cfg.Registry.Consul.ServiceName, "registry.consul.register.name", defaultConfig.Registry.Consul.ServiceName, "service registration name")
f.StringSliceVar(&cfg.Registry.Consul.ServiceTags, "registry.consul.register.tags", defaultConfig.Registry.Consul.ServiceTags, "service registration tags")
f.StringSliceVar(&cfg.Registry.Consul.ServiceStatus, "registry.consul.service.status", defaultConfig.Registry.Consul.ServiceStatus, "valid service status values")
Expand Down Expand Up @@ -247,6 +247,12 @@ func load(cmdline, environ, envprefix []string, props *properties.Properties) (c

cfg.Proxy.AuthSchemes = authSchemes

// Unless registry.consul.register.addr has been set explicitly it should
// be the same as ui.addr. See issue 657.
if !f.IsSet("registry.consul.register.addr") {
cfg.Registry.Consul.ServiceAddr = uiListenerValue
}

if uiListenerValue != "" {
kvs, err := parseKVSlice(uiListenerValue)
if err != nil {
Expand Down

0 comments on commit a7ea05c

Please sign in to comment.