selector: use custom domain (#1760)

* util/wrapper: improve auth errors

* client: add network call option

* client/selector: add domain select option

* client/grpc: pass network option to selector
This commit is contained in:
ben-toogood 2020-06-30 10:07:52 +01:00 committed by Vasiliy Tolstov
parent 9683d38d19
commit ea93f93b18

View File

@ -84,8 +84,14 @@ func (g *grpcClient) next(request client.Request, opts client.CallOptions) (sele
}, nil
}
// if the network was set, pass it to the selector
sopts := opts.SelectOptions
if len(opts.Network) > 0 {
sopts = append(sopts, selector.WithDomain(opts.Network))
}
// get next nodes from the selector
next, err := g.opts.Selector.Select(service, opts.SelectOptions...)
next, err := g.opts.Selector.Select(service, sopts...)
if err != nil {
if err == selector.ErrNotFound {
return nil, errors.InternalServerError("go.micro.client", "service %s: %s", service, err.Error())