add convenience method to pull params from config

This commit is contained in:
Joel Wetzell
2026-03-01 14:57:19 -06:00
parent 183182e6cd
commit c298f63ffc
69 changed files with 591 additions and 1081 deletions

View File

@@ -2,7 +2,7 @@ package processor
import (
"context"
"errors"
"fmt"
"github.com/expr-lang/expr"
"github.com/expr-lang/expr/vm"
@@ -35,16 +35,9 @@ func init() {
New: func(config config.ProcessorConfig) (Processor, error) {
params := config.Params
expression, ok := params["expression"]
if !ok {
return nil, errors.New("script.expr requires an expression parameter")
}
expressionString, ok := expression.(string)
if !ok {
return nil, errors.New("script.expr expression must be a string")
expressionString, err := params.GetString("expression")
if err != nil {
return nil, fmt.Errorf("script.expr expression error: %w", err)
}
program, err := expr.Compile(expressionString)