44 "fmt"
55
66 "github.com/ethpandaops/assertoor/pkg/coordinator/helper"
7- "github.com/ethpandaops/assertoor/pkg/coordinator/human-duration"
87 "github.com/ethpandaops/assertoor/pkg/coordinator/types"
98 "gopkg.in/yaml.v3"
109)
@@ -18,37 +17,18 @@ func (ts *TaskScheduler) ParseTaskOptions(rawtask *helper.RawMessage) (*types.Ta
1817 return options , nil
1918}
2019
21- type TaskOptsSettings struct {
22- // The title of the task - this is used to describe the task to the user.
23- Title string `yaml:"title" json:"title"`
24- // The configuration settings to consume from runtime variables.
25- ConfigVars map [string ]string `yaml:"configVars" json:"configVars"`
26- // Timeout defines the max time waiting for the condition to be met.
27- Timeout human.Duration `yaml:"timeout" json:"timeout"`
28- }
29-
30- func (ts * TaskScheduler ) NewTaskOptions (task * types.TaskDescriptor , config interface {}, settings * TaskOptsSettings ) (* types.TaskOptions , error ) {
31- options := & types.TaskOptions {
32- Name : task .Name ,
20+ func GetRawConfig (config interface {}) * helper.RawMessage {
21+ configYaml , err := yaml .Marshal (config )
22+ if err != nil {
23+ return nil
3324 }
3425
35- if settings != nil {
36- options .Title = settings .Title
37- options .ConfigVars = settings .ConfigVars
38- options .Timeout = settings .Timeout
39- }
26+ configRaw := helper.RawMessage {}
4027
41- if config != nil {
42- configYaml , err := yaml .Marshal (config )
43- if err != nil {
44- return nil , fmt .Errorf ("error serializing task config: %w" , err )
45- }
46-
47- err = yaml .Unmarshal (configYaml , options .Config )
48- if err != nil {
49- return nil , fmt .Errorf ("error parsing task config: %w" , err )
50- }
28+ err = yaml .Unmarshal (configYaml , & configRaw )
29+ if err != nil {
30+ return nil
5131 }
5232
53- return options , nil
33+ return & configRaw
5434}
0 commit comments