Add endpoints in etcd

This commit is contained in:
Asim 2015-10-11 16:41:55 +01:00
parent 763608854b
commit 6ab6e9725d

View File

@ -66,8 +66,10 @@ func (e *etcdRegistry) Register(s *registry.Service) error {
}
service := &registry.Service{
Name: s.Name,
Metadata: s.Metadata,
Name: s.Name,
Version: s.Version,
Metadata: s.Metadata,
Endpoints: s.Endpoints,
}
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)
s.Name = sn.Name
s.Version = sn.Version
s.Metadata = sn.Metadata
s.Endpoints = sn.Endpoints
for _, node := range sn.Nodes {
s.Nodes = append(s.Nodes, node)
}