Add endpoints in etcd
This commit is contained in:
parent
763608854b
commit
6ab6e9725d
@ -67,7 +67,9 @@ func (e *etcdRegistry) Register(s *registry.Service) error {
|
|||||||
|
|
||||||
service := ®istry.Service{
|
service := ®istry.Service{
|
||||||
Name: s.Name,
|
Name: s.Name,
|
||||||
|
Version: s.Version,
|
||||||
Metadata: s.Metadata,
|
Metadata: s.Metadata,
|
||||||
|
Endpoints: s.Endpoints,
|
||||||
}
|
}
|
||||||
|
|
||||||
e.client.Set(context.Background(), servicePath(s.Name), "", &etcd.SetOptions{Dir: true})
|
e.client.Set(context.Background(), servicePath(s.Name), "", &etcd.SetOptions{Dir: true})
|
||||||
@ -105,7 +107,9 @@ func (e *etcdRegistry) GetService(name string) (*registry.Service, error) {
|
|||||||
}
|
}
|
||||||
sn := decode(n.Value)
|
sn := decode(n.Value)
|
||||||
s.Name = sn.Name
|
s.Name = sn.Name
|
||||||
|
s.Version = sn.Version
|
||||||
s.Metadata = sn.Metadata
|
s.Metadata = sn.Metadata
|
||||||
|
s.Endpoints = sn.Endpoints
|
||||||
for _, node := range sn.Nodes {
|
for _, node := range sn.Nodes {
|
||||||
s.Nodes = append(s.Nodes, node)
|
s.Nodes = append(s.Nodes, node)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user