feat: using js as filter syntax

This commit is contained in:
Tine 2024-05-24 22:22:19 +02:00
parent 3e68f03097
commit c2eabedb91
Signed by: mentos1386
SSH key fingerprint: SHA256:MNtTsLbihYaWF8j1fkOHfkKNlnN1JQfxEU/rBU8nCGw

View file

@ -6,13 +6,21 @@ import (
"github.com/mentos1386/zdravko/internal/temporal" "github.com/mentos1386/zdravko/internal/temporal"
"github.com/mentos1386/zdravko/pkg/k6" "github.com/mentos1386/zdravko/pkg/k6"
_ "github.com/mentos1386/zdravko/pkg/k6/zdravko" "github.com/mentos1386/zdravko/pkg/k6/zdravko"
"github.com/mentos1386/zdravko/pkg/script" "github.com/mentos1386/zdravko/pkg/script"
) )
func (a *Activities) Check(ctx context.Context, param temporal.ActivityCheckParam) (*temporal.ActivityCheckResult, error) { func (a *Activities) Check(ctx context.Context, param temporal.ActivityCheckParam) (*temporal.ActivityCheckResult, error) {
execution := k6.NewExecution(slog.Default(), script.UnescapeString(param.Script)) execution := k6.NewExecution(slog.Default(), script.UnescapeString(param.Script))
ctx = zdravko.WithZdravkoContext(ctx, zdravko.Context{
Target: zdravko.Target{
Name: param.Target.Name,
Group: param.Target.Group,
//Metadata: param.Target.Metadata,
},
})
result, err := execution.Run(ctx) result, err := execution.Run(ctx)
if err != nil { if err != nil {
return nil, err return nil, err