package generator import ( "io/ioutil" "gogs.carduccidante.edu.it/karmen/core/config" "gopkg.in/yaml.v2" ) type Generator interface { Run() SetJobId(id uint) } type Config struct { config.ConfigT KeepArtifacts bool `yaml:"keep_artifacts"` OutputPath string `yaml:"output_path"` CloudPath string `yaml:"cloud_path"` } var ( Generators map[string]Generator ) // ReadFile reads the config file placed at the given path. func ReadFile(path string, conf *Config) error { err := config.ReadFile(path, &conf.ConfigT) if err != nil { return err } cf, err := ioutil.ReadFile(path) if err != nil { return err } if err := yaml.Unmarshal(cf, conf); err != nil { return err } return nil }