Add runtime to service.Options()

This commit is contained in:
Ben Toogood
2020-05-11 17:09:28 +01:00
parent 688228377b
commit f892b41299
6 changed files with 42 additions and 20 deletions

View File

@@ -14,6 +14,7 @@ import (
"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/runtime"
"github.com/micro/go-micro/v2/server"
"github.com/micro/go-micro/v2/store"
"github.com/micro/go-micro/v2/transport"
@@ -29,6 +30,7 @@ type Options struct {
Server server.Server
Store store.Store
Registry registry.Registry
Runtime runtime.Runtime
Transport transport.Transport
Profile profile.Profile
@@ -55,6 +57,7 @@ func newOptions(opts ...Option) Options {
Server: server.DefaultServer,
Store: store.DefaultStore,
Registry: registry.DefaultRegistry,
Runtime: runtime.DefaultRuntime,
Transport: transport.DefaultTransport,
Context: context.Background(),
Signal: true,
@@ -182,6 +185,13 @@ func Transport(t transport.Transport) Option {
}
}
// Runtime sets the runtime
func Runtime(r runtime.Runtime) Option {
return func(o *Options) {
o.Runtime = r
}
}
// Convenience options
// Address sets the address of the server