...

Source file src/github.com/ory/x/configx/context.go

Documentation: github.com/ory/x/configx

     1  package configx
     2  
     3  import "context"
     4  
     5  type contextKey int
     6  
     7  const configContextKey contextKey = iota + 1
     8  
     9  func ContextWithConfigOptions(ctx context.Context, opts ...OptionModifier) context.Context {
    10  	return context.WithValue(ctx, configContextKey, opts)
    11  }
    12  
    13  func ConfigOptionsFromContext(ctx context.Context) []OptionModifier {
    14  	opts, ok := ctx.Value(configContextKey).([]OptionModifier)
    15  	if !ok {
    16  		return []OptionModifier{}
    17  	}
    18  	return opts
    19  }
    20  

View as plain text