polemos/state/config.go

31 lines
521 B
Go
Raw Normal View History

package state
import (
"io/ioutil"
"gopkg.in/yaml.v3"
)
type Config struct {
AWS struct {
2023-03-20 15:43:14 +01:00
Regions []string `yaml:"regions"`
Credentials_path string `yaml:"credentials_path"`
} `yaml:"aws"`
}
func Load_conf(filename string) (Config, error) {
var config Config
data, err := ioutil.ReadFile(filename)
if err != nil {
return config, err
}
err = yaml.Unmarshal(data, &config)
if err != nil {
return config, err
}
return config, nil
}