diff --git a/server/context.go b/server/context.go index fa9f3c8b..daa70554 100644 --- a/server/context.go +++ b/server/context.go @@ -15,8 +15,18 @@ func NewContext(ctx context.Context, s Server) context.Context { return context.WithValue(ctx, serverKey{}, s) } -// SetServerSubscriberOption returns a function to setup a context with given value -func SetServerSubscriberOption(k, v interface{}) SubscriberOption { +// Setoption returns a function to setup a context with given value +func SetOption(k, v interface{}) Option { + return func(o *Options) { + if o.Context == nil { + o.Context = context.Background() + } + o.Context = context.WithValue(o.Context, k, v) + } +} + +// SetSubscriberOption returns a function to setup a context with given value +func SetSubscriberOption(k, v interface{}) SubscriberOption { return func(o *SubscriberOptions) { if o.Context == nil { o.Context = context.Background()