-
Notifications
You must be signed in to change notification settings - Fork 5
/
config.go
36 lines (27 loc) · 1.04 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package runtaskbackground
import (
"errors"
"github.com/ethpandaops/assertoor/pkg/coordinator/helper"
)
type Config struct {
ForegroundTask *helper.RawMessage `yaml:"foregroundTask" json:"foregroundTask"`
BackgroundTask *helper.RawMessage `yaml:"backgroundTask" json:"backgroundTask"`
ExitOnForegroundSuccess bool `yaml:"exitOnForegroundSuccess" json:"exitOnForegroundSuccess"`
ExitOnForegroundFailure bool `yaml:"exitOnForegroundFailure" json:"exitOnForegroundFailure"`
// action when background task stops
// "ignore" - do nothing (default)
// "fail" - exit with failure
// "succeed" - exit with success
// "failOrIgnore" - exit with failure if background task failed, ignore on success
OnBackgroundComplete string `yaml:"onBackgroundComplete" json:"onBackgroundComplete"`
NewVariableScope bool `yaml:"newVariableScope" json:"newVariableScope"`
}
func DefaultConfig() Config {
return Config{}
}
func (c *Config) Validate() error {
if c.ForegroundTask == nil {
return errors.New("foreground task must be specified")
}
return nil
}