Set option and cli args to the service profile (#1259)

This commit is contained in:
Di Wu
2020-02-26 00:42:43 +08:00
committed by GitHub
parent 53c3bff819
commit 603d37b135
5 changed files with 61 additions and 21 deletions

View File

@@ -10,6 +10,7 @@ import (
"github.com/micro/go-micro/v2/client"
"github.com/micro/go-micro/v2/client/selector"
"github.com/micro/go-micro/v2/config/cmd"
"github.com/micro/go-micro/v2/debug/profile"
"github.com/micro/go-micro/v2/debug/trace"
"github.com/micro/go-micro/v2/registry"
"github.com/micro/go-micro/v2/server"
@@ -25,6 +26,7 @@ type Options struct {
Server server.Server
Registry registry.Registry
Transport transport.Transport
Profile profile.Profile
// Before and After funcs
BeforeStart []func() error
@@ -99,6 +101,13 @@ func HandleSignal(b bool) Option {
}
}
// Profile to be used for debug profile
func Profile(p profile.Profile) Option {
return func(o *Options) {
o.Profile = p
}
}
// Server to be used for service
func Server(s server.Server) Option {
return func(o *Options) {