syntactic sugar
This commit is contained in:
@@ -9,13 +9,12 @@ import (
|
||||
|
||||
type optionsKey struct{}
|
||||
|
||||
// Options allow to inject a nats.Options struct for configuring
|
||||
// the nats connection
|
||||
func Options(nopts nats.Options) broker.Option {
|
||||
// Options accepts nats.Options
|
||||
func Options(opts nats.Options) broker.Option {
|
||||
return func(o *broker.Options) {
|
||||
if o.Context == nil {
|
||||
o.Context = context.Background()
|
||||
}
|
||||
o.Context = context.WithValue(o.Context, optionsKey{}, nopts)
|
||||
o.Context = context.WithValue(o.Context, optionsKey{}, opts)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user