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

Function FromConfig

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

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