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