diff --git a/core/const.go b/core/const.go index cdba4a9..aa85064 100644 --- a/core/const.go +++ b/core/const.go @@ -16,8 +16,8 @@ const ( EnvEtcdPassword = "XSERVICE_ETCD_PASSWORD" // config key - ConfigServiceAddr = "http.address" - ConfigServiceAdviceAddr = "http.advice_address" + ConfigServiceAddr = "http.address" + ConfigServiceAdvertisedAddr = "http.advertised_address" ServiceConfigKeyPrefix = "xservice/config" ServiceRegisterKeyPrefix = "xservice/register" diff --git a/core/xservice/option.go b/core/xservice/option.go index fa23575..27b6e0d 100644 --- a/core/xservice/option.go +++ b/core/xservice/option.go @@ -112,7 +112,7 @@ func loadOptions(options ...Option) *Options { } if opts.Config.IsSet(core.ConfigServiceAddr) { - addviceAddr := opts.Config.GetString(core.ConfigServiceAdviceAddr) + addviceAddr := opts.Config.GetString(core.ConfigServiceAdvertisedAddr) if addviceAddr == "" { address := opts.Config.GetString(core.ConfigServiceAddr) _, port, err := net.SplitHostPort(address) @@ -121,7 +121,7 @@ func loadOptions(options ...Option) *Options { } addviceAddr = net.JoinHostPort(netx.InternalIp(), port) - opts.Config.SetDefault(core.ConfigServiceAdviceAddr, addviceAddr) + opts.Config.SetDefault(core.ConfigServiceAdvertisedAddr, addviceAddr) } } diff --git a/core/xservice/server.go b/core/xservice/server.go index 4b7d614..40058fc 100644 --- a/core/xservice/server.go +++ b/core/xservice/server.go @@ -388,7 +388,7 @@ func (t *serverImpl) doRegisterGrpcServiceEtcd(ctx context.Context) { if sl, ok := leaseMap[desc.ServiceName]; ok { return sl } - addr := t.options.Config.GetString(core.ConfigServiceAdviceAddr) + addr := t.options.Config.GetString(core.ConfigServiceAdvertisedAddr) sl := &serviceLease{ id: 0, lease: clientv3.NewLease(client), diff --git a/tools/xservice/gogen/assets/project/config-example.yaml b/tools/xservice/gogen/assets/project/config-example.yaml index 0f352d5..b238add 100644 --- a/tools/xservice/gogen/assets/project/config-example.yaml +++ b/tools/xservice/gogen/assets/project/config-example.yaml @@ -1,7 +1,7 @@ http: address: 0.0.0.0:5000 - # advice address for service discover. eg load balancer, or server external network address - # advice_address: 192.168.8.20:5000 + # advertised address for service discover. eg load balancer, or server external network address + # advertised_address: 192.168.8.20:5000 # jaeger configuration # env configuration is ok, refer: https://www.jaegertracing.io/docs/1.23/client-features