1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-08-10 21:52:01 +02:00

Add flag for registry service client

This commit is contained in:
Asim Aslam
2019-09-25 11:09:19 +01:00
parent 624d37cf13
commit 7fe64192a7
2 changed files with 16 additions and 6 deletions

View File

@@ -134,7 +134,14 @@ func NewRegistry(opts ...registry.Option) registry.Registry {
o(&options)
}
// use mdns to find the service registry
// the registry address
addrs := options.Addrs
if len(addrs) == 0 {
addrs = []string{"127.0.0.1:8000"}
}
// use mdns as a fall back in case its used
mReg := registry.NewRegistry()
// create new client with mdns
@@ -149,7 +156,7 @@ func NewRegistry(opts ...registry.Option) registry.Registry {
return &serviceRegistry{
opts: options,
name: name,
address: options.Addrs,
address: addrs,
client: pb.NewRegistryService(name, cli),
}
}