-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.go
41 lines (32 loc) · 1.01 KB
/
config.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
37
38
39
40
41
package main
import (
"io/ioutil"
"gopkg.in/yaml.v2"
)
type SyncConfig struct {
Interval string `yaml:"interval"`
DeleteDestinationRules bool `yaml:"delete_destination_rules"`
Source SourceConfig `yaml:"source"`
Destinations []DestinationConfig `yaml:"destinations"`
}
func NewSyncConfig(path string) (*SyncConfig, error) {
cfg := &SyncConfig{}
dat, err := ioutil.ReadFile(path)
if err != nil {
return nil, err
}
err = yaml.Unmarshal(dat, cfg)
return cfg, err
}
type SourceConfig struct {
AWSAccessKeyID string `yaml:"aws_access_key_id"`
AWSSectedAccessKey string `yaml:"aws_secret_access_key"`
Region string `yaml:"region"`
GroupID string `yaml:"group_id"`
}
type DestinationConfig struct {
AWSAccessKeyID string `yaml:"aws_access_key_id"`
AWSSectedAccessKey string `yaml:"aws_secret_access_key"`
Region string `yaml:"region"`
GroupIDs []string `yaml:"group_ids"`
}