(e ast.VariableExpr)
| 181 | } |
| 182 | |
| 183 | func variableExprExecutor(e ast.VariableExpr) (expressionExecutor, error) { |
| 184 | return func(ctx context.Context, options *Options, data *model.Value) (*model.Value, error) { |
| 185 | //ctx = WithExecutorID(ctx, "variableExpr") |
| 186 | varName := e.Name |
| 187 | res, ok := options.Vars[varName] |
| 188 | if ok { |
| 189 | return res, nil |
| 190 | } |
| 191 | |
| 192 | envVarValue := os.Getenv(varName) |
| 193 | if envVarValue != "" { |
| 194 | return model.NewStringValue(envVarValue), nil |
| 195 | } |
| 196 | |
| 197 | return nil, fmt.Errorf("variable %s not found", varName) |
| 198 | }, nil |
| 199 | } |
no test coverage detected