Monorepo for Tangled tangled.org

spindle: parse `time.Duration` when parsing spindle config

Signed-off-by: Seongmin Lee <git@boltless.me>

boltless.me 7ae98c9a 2977dad5

verified
+4 -10
+3 -2
spindle/config/config.go
··· 4 4 "context" 5 5 "fmt" 6 6 "path/filepath" 7 + "time" 7 8 8 9 "github.com/bluesky-social/indigo/atproto/syntax" 9 10 "github.com/sethvargo/go-envconfig" ··· 46 47 } 47 48 48 49 type NixeryPipelines struct { 49 - Nixery string `env:"NIXERY, default=nixery.tangled.sh"` 50 - WorkflowTimeout string `env:"WORKFLOW_TIMEOUT, default=5m"` 50 + Nixery string `env:"NIXERY, default=nixery.tangled.sh"` 51 + WorkflowTimeout time.Duration `env:"WORKFLOW_TIMEOUT, default=5m"` 51 52 } 52 53 53 54 type Config struct {
+1 -8
spindle/engines/nixery/engine.go
··· 122 122 } 123 123 124 124 func (e *Engine) WorkflowTimeout() time.Duration { 125 - workflowTimeoutStr := e.cfg.NixeryPipelines.WorkflowTimeout 126 - workflowTimeout, err := time.ParseDuration(workflowTimeoutStr) 127 - if err != nil { 128 - e.l.Error("failed to parse workflow timeout", "error", err, "timeout", workflowTimeoutStr) 129 - workflowTimeout = 5 * time.Minute 130 - } 131 - 132 - return workflowTimeout 125 + return e.cfg.NixeryPipelines.WorkflowTimeout 133 126 } 134 127 135 128 func workflowImage(deps map[string][]string, nixery string) string {