From ea93f93b189edf520d75fba6f2f80465f02392f0 Mon Sep 17 00:00:00 2001 From: ben-toogood Date: Tue, 30 Jun 2020 10:07:52 +0100 Subject: [PATCH] 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 --- grpc.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/grpc.go b/grpc.go index 7571e5b..42a31e0 100644 --- a/grpc.go +++ b/grpc.go @@ -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())