2023-03-15 15:30:29 +01:00
|
|
|
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"`
|
2023-03-15 15:30:29 +01:00
|
|
|
} `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
|
|
|
|
}
|