1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-07-06 22:35:51 +02:00
Files
go-micro/plugins/config/source/runtimevar/options.go
2021-01-20 21:01:10 +00:00

21 lines
410 B
Go

package runtimevar
import (
"context"
"github.com/asim/go-micro/v3/config/source"
"gocloud.dev/runtimevar"
)
type variableKey struct{}
// WithVariable sets the runtimevar.Variable.
func WithVariable(v *runtimevar.Variable) source.Option {
return func(o *source.Options) {
if o.Context == nil {
o.Context = context.Background()
}
o.Context = context.WithValue(o.Context, variableKey{}, v)
}
}