-
Notifications
You must be signed in to change notification settings - Fork 251
/
runnerconfig.go
36 lines (30 loc) · 973 Bytes
/
runnerconfig.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 cfg
import (
"os"
"gopkg.in/yaml.v3"
)
// RunnerConfig defines the configuration for taskcluster-worker-starter. See the usage
// string for field descriptions
type RunnerConfig struct {
Provider ProviderConfig `yaml:"provider"`
WorkerImplementation WorkerImplementationConfig `yaml:"worker"`
WorkerConfig *WorkerConfig `yaml:"workerConfig"`
Logging *LoggingConfig `yaml:"logging"`
GetSecrets bool `yaml:"getSecrets"`
CacheOverRestarts string `yaml:"cacheOverRestarts"`
}
// Load a configuration file
func LoadRunnerConfig(filename string) (*RunnerConfig, error) {
data, err := os.ReadFile(filename)
if err != nil {
return nil, err
}
var runnercfg RunnerConfig
// set nonzero defaults
runnercfg.GetSecrets = true
err = yaml.Unmarshal(data, &runnercfg)
if err != nil {
return nil, err
}
return &runnercfg, nil
}