go-micro.dev/v5@v5.12.0/transport/nats/options.go (about) 1 package nats 2 3 import ( 4 "context" 5 6 "github.com/nats-io/nats.go" 7 "go-micro.dev/v5/transport" 8 ) 9 10 type optionsKey struct{} 11 12 // Options allow to inject a nats.Options struct for configuring 13 // the nats connection. 14 func Options(nopts nats.Options) transport.Option { 15 return func(o *transport.Options) { 16 if o.Context == nil { 17 o.Context = context.Background() 18 } 19 o.Context = context.WithValue(o.Context, optionsKey{}, nopts) 20 } 21 }