Skip to content

Commit

Permalink
Support modification of prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
logicwu0 committed May 12, 2024
1 parent c99aabb commit cad3c1e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions etcd_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ type registerMeta struct {
// NewEtcdRegistry creates an etcd based registry.
func NewEtcdRegistry(endpoints []string, opts ...Option) (registry.Registry, error) {
cfg := &ConfigWithPrefix{
Configs: &clientv3.Config{ // 注意这里添加了 & 来获取 Config 的地址
Configs: &clientv3.Config{
Endpoints: endpoints,
},
Prefix: "kitex/registry-etcd", // 默认前缀
Prefix: "kitex/registry-etcd",
}
for _, opt := range opts {
opt(cfg)
Expand Down Expand Up @@ -92,10 +92,10 @@ func SetFixedAddress(r registry.Registry, address net.Addr) {
// NewEtcdRegistryWithRetry creates an etcd based registry with given custom retry configs
func NewEtcdRegistryWithRetry(endpoints []string, retryConfig *retry.Config, opts ...Option) (registry.Registry, error) {
cfg := &ConfigWithPrefix{
Configs: &clientv3.Config{ // 注意这里添加了 & 来获取 Config 的地址
Configs: &clientv3.Config{
Endpoints: endpoints,
},
Prefix: "defaultPrefix", // 默认前缀
Prefix: "kitex/registry-etcd",
}
for _, opt := range opts {
opt(cfg)
Expand Down
4 changes: 2 additions & 2 deletions etcd_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ type etcdResolver struct {
// NewEtcdResolver creates a etcd based resolver.
func NewEtcdResolver(endpoints []string, opts ...Option) (discovery.Resolver, error) {
cfg := &ConfigWithPrefix{
Configs: &clientv3.Config{ // 注意这里添加了 & 来获取 Config 的地址
Configs: &clientv3.Config{
Endpoints: endpoints,
},
Prefix: "kitex/registry-etcd", // 默认前缀
Prefix: "kitex/registry-etcd",
}
for _, opt := range opts {
opt(cfg)
Expand Down

0 comments on commit cad3c1e

Please sign in to comment.