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

Function FromConfig

cel/options.go:533–550  ·  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

531// as the type provider configured at the time when the config is processed is the one used to derive
532// type references from the configuration.
533func FromConfig(config *env.Config, optFactories ...ConfigOptionFactory) EnvOption {
534 return func(e *Env) (*Env, error) {
535 if err := config.Validate(); err != nil {
536 return nil, err
537 }
538 opts, err := configToEnvOptions(config, e.CELTypeProvider(), optFactories)
539 if err != nil {
540 return nil, err
541 }
542 for _, o := range opts {
543 e, err = o(e)
544 if err != nil {
545 return nil, err
546 }
547 }
548 return e, nil
549 }
550}
551
552// configToEnvOptions generates a set of EnvOption values (or error) based on a config, a type provider,
553// and an optional set of environment options.

Callers 7

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 3

configFromEnvProtoFunction · 0.74
TestEnvFromConfigFunction · 0.56
TestEnvFromConfigErrorsFunction · 0.56