From 4fd4a116f268be54253fdffb363fadfd4e5163d6 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Mon, 17 Aug 2020 22:53:20 +0100 Subject: [PATCH] allow setting registry router in client --- client/options.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client/options.go b/client/options.go index a4adeb0a..3fc5a3f2 100644 --- a/client/options.go +++ b/client/options.go @@ -7,6 +7,7 @@ import ( "github.com/micro/go-micro/v3/broker" "github.com/micro/go-micro/v3/broker/http" "github.com/micro/go-micro/v3/codec" + "github.com/micro/go-micro/v3/registry" "github.com/micro/go-micro/v3/router" regRouter "github.com/micro/go-micro/v3/router/registry" "github.com/micro/go-micro/v3/selector" @@ -184,6 +185,13 @@ func Transport(t transport.Transport) Option { } } +// Registry sets the routers registry +func Registry(r registry.Registry) Option { + return func(o *Options) { + o.Router.Init(router.Registry(r)) + } +} + // Router is used to lookup routes for a service func Router(r router.Router) Option { return func(o *Options) {