use metadata helper
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
34d93306d6
commit
2fc47782cf
@ -3,6 +3,7 @@ package registry
|
|||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
|
"github.com/unistack-org/micro/v3/metadata"
|
||||||
"github.com/unistack-org/micro/v3/registry"
|
"github.com/unistack-org/micro/v3/registry"
|
||||||
"github.com/unistack-org/micro/v3/server"
|
"github.com/unistack-org/micro/v3/server"
|
||||||
"github.com/unistack-org/micro/v3/util/addr"
|
"github.com/unistack-org/micro/v3/util/addr"
|
||||||
@ -172,12 +173,8 @@ func NewService(s server.Server) (*registry.Service, error) {
|
|||||||
node := ®istry.Node{
|
node := ®istry.Node{
|
||||||
Id: opts.Name + "-" + opts.Id,
|
Id: opts.Name + "-" + opts.Id,
|
||||||
Address: net.JoinHostPort(addr, port),
|
Address: net.JoinHostPort(addr, port),
|
||||||
Metadata: opts.Metadata,
|
|
||||||
}
|
|
||||||
|
|
||||||
if node.Metadata == nil {
|
|
||||||
node.Metadata = make(map[string]string, 3)
|
|
||||||
}
|
}
|
||||||
|
node.Metadata = metadata.Copy(opts.Metadata)
|
||||||
|
|
||||||
node.Metadata["server"] = s.String()
|
node.Metadata["server"] = s.String()
|
||||||
node.Metadata["broker"] = opts.Broker.String()
|
node.Metadata["broker"] = opts.Broker.String()
|
||||||
|
Loading…
Reference in New Issue
Block a user