From 11ed5e49d85cd332f79bed324450ccd07e5ea601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Thu, 18 Feb 2021 10:00:16 +0000 Subject: [PATCH] same order of options in grpc and http service MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- ocis-pkg/service/grpc/service.go | 13 ++++--------- ocis-pkg/service/http/service.go | 10 +++++----- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/ocis-pkg/service/grpc/service.go b/ocis-pkg/service/grpc/service.go index ca1ce530e0..769f4a7393 100644 --- a/ocis-pkg/service/grpc/service.go +++ b/ocis-pkg/service/grpc/service.go @@ -43,24 +43,19 @@ func NewService(opts ...Option) Service { Msg("starting server") mopts := []micro.Option{ - // This needs to be first as it replaces the underlying server - // which causes any configuration set before it - // to be discarded micro.Server(grpc.NewServer()), - // TODO(refs) ideally we want to pass micro options from the consumers - micro.Version(sopts.Version), micro.Address(sopts.Address), + micro.Name(strings.Join([]string{sopts.Namespace, sopts.Name}, ".")), + micro.Version(sopts.Version), micro.Context(sopts.Context), micro.Flags(sopts.Flags...), - micro.Name(strings.Join([]string{sopts.Namespace, sopts.Name}, ".")), - micro.Client(DefaultClient), micro.Registry(*registry.GetRegistry()), + micro.RegisterTTL(time.Second * 30), + micro.RegisterInterval(time.Second * 10), micro.WrapHandler(prometheus.NewHandlerWrapper()), micro.WrapClient(opencensus.NewClientWrapper()), micro.WrapHandler(opencensus.NewHandlerWrapper()), micro.WrapSubscriber(opencensus.NewSubscriberWrapper()), - micro.RegisterTTL(time.Second * 30), - micro.RegisterInterval(time.Second * 10), } return Service{micro.NewService(mopts...)} diff --git a/ocis-pkg/service/http/service.go b/ocis-pkg/service/http/service.go index 62c663d273..57022dbcdc 100644 --- a/ocis-pkg/service/http/service.go +++ b/ocis-pkg/service/http/service.go @@ -27,14 +27,14 @@ func NewService(opts ...Option) Service { wopts := []micro.Option{ micro.Server(http.NewServer(server.TLSConfig(sopts.TLSConfig))), - micro.Registry(*registry.GetRegistry()), micro.Address(sopts.Address), - micro.RegisterTTL(time.Second * 30), - micro.RegisterInterval(time.Second * 10), - micro.Context(sopts.Context), - micro.Flags(sopts.Flags...), micro.Name(strings.Join([]string{sopts.Namespace, sopts.Name}, ".")), micro.Version(sopts.Version), + micro.Context(sopts.Context), + micro.Flags(sopts.Flags...), + micro.Registry(*registry.GetRegistry()), + micro.RegisterTTL(time.Second * 30), + micro.RegisterInterval(time.Second * 10), } return Service{micro.NewService(wopts...)}