Skip to content

Commit

Permalink
Remove token from builtin rules (#2550)
Browse files Browse the repository at this point in the history
  • Loading branch information
eleftherias authored Mar 7, 2024
1 parent 87d9bea commit ed53d75
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions internal/engine/ingester/builtin/builtin.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,15 @@ type BuiltinRuleDataIngest struct {
builtinCfg *pb.BuiltinType
ruleMethods rule_methods.Methods
method string
accessToken string
}

// NewBuiltinRuleDataIngest creates a new builtin rule data ingest engine
func NewBuiltinRuleDataIngest(
builtinCfg *pb.BuiltinType,
pbuild *providers.ProviderBuilder,
_ *providers.ProviderBuilder,
) (*BuiltinRuleDataIngest, error) {
return &BuiltinRuleDataIngest{
builtinCfg: builtinCfg,
accessToken: pbuild.GetToken(),
method: builtinCfg.GetMethod(),
ruleMethods: &rule_methods.RuleMethods{},
}, nil
Expand Down Expand Up @@ -98,8 +96,7 @@ func (idi *BuiltinRuleDataIngest) Ingest(ctx context.Context, ent protoreflect.P

// call method
// Call the method (empty parameter list)
result := method.Call([]reflect.Value{reflect.ValueOf(ctx),
reflect.ValueOf(idi.accessToken), reflect.ValueOf(ent)})
result := method.Call([]reflect.Value{reflect.ValueOf(ctx), reflect.ValueOf(ent)})
if len(result) != 2 {
return nil, fmt.Errorf("rule method should return 3 values")
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/rule_methods/rule_methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ func (r *RuleMethods) GetMethod(mName string) (reflect.Value, error) {
}

// Passthrough is a method that passes the entity through, just marshalling it
func (_ *RuleMethods) Passthrough(_ context.Context, _ string, ent protoreflect.ProtoMessage) (json.RawMessage, error) {
func (_ *RuleMethods) Passthrough(_ context.Context, ent protoreflect.ProtoMessage) (json.RawMessage, error) {
return protojson.Marshal(ent)
}

0 comments on commit ed53d75

Please sign in to comment.