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 GitHub
parent deea8fecf4
commit 0f5c53b6e4
5 changed files with 42 additions and 7 deletions

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())