MCPcopy Create free account
hub / github.com/cel-expr/cel-go / FromConfig

Function FromConfig

cel/options.go:545–562  ·  view source on GitHub ↗

FromConfig produces and applies a set of EnvOption values derived from an env.Config object. For configuration elements which refer to features outside of the `cel` package, an optional set of ConfigOptionFactory values may be passed in to support the conversion from static configuration to configu

(config *env.Config, optFactories ...ConfigOptionFactory)

Source from the content-addressed store, hash-verified

543// as the type provider configured at the time when the config is processed is the one used to derive
544// type references from the configuration.
545func FromConfig(config *env.Config, optFactories ...ConfigOptionFactory) EnvOption {
546 return func(e *Env) (*Env, error) {
547 if err := config.Validate(); err != nil {
548 return nil, err
549 }
550 opts, err := configToEnvOptions(config, e.CELTypeProvider(), optFactories)
551 if err != nil {
552 return nil, err
553 }
554 for _, o := range opts {
555 e, err = o(e)
556 if err != nil {
557 return nil, err
558 }
559 }
560 return e, nil
561 }
562}
563
564// configToEnvOptions generates a set of EnvOption values (or error) based on a config, a type provider,
565// and an optional set of environment options.

Callers 8

configFromEnvProtoFunction · 0.92
extensionOptFunction · 0.92
EnvironmentFileFunction · 0.92
FromConfigFunction · 0.92
parseYAMLConfigMethod · 0.92
TestEnvFromConfigFunction · 0.70
TestEnvFromConfigErrorsFunction · 0.70

Calls 3

configToEnvOptionsFunction · 0.85
CELTypeProviderMethod · 0.80
ValidateMethod · 0.65

Tested by 4

configFromEnvProtoFunction · 0.74
TestEnvFromConfigFunction · 0.56
TestEnvFromConfigErrorsFunction · 0.56