github.com/redhat-appstudio/e2e-tests@v0.0.0-20230619105049-9a422b2094d7/tests/e2e-demos/config/config.go (about) 1 package config 2 3 import ( 4 "os" 5 "path/filepath" 6 7 "gopkg.in/yaml.v2" 8 ) 9 10 func LoadTestGeneratorConfig(configPath string) (WorkflowSpec, error) { 11 c := WorkflowSpec{} 12 // Open config file 13 file, err := os.Open(filepath.Clean(configPath)) 14 if err != nil { 15 return c, err 16 } 17 18 // Init new YAML decode 19 d := yaml.NewDecoder(file) 20 21 // Start YAML decoding from file 22 if err := d.Decode(&c); err != nil { 23 return c, err 24 } 25 26 return c, nil 27 }