blob: ba853e14b29093dfdd2f7ac043f4c1721602414d (
plain)
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
42
43
44
45
46
47
48
49
|
package main
import (
"io/ioutil"
"log"
"gopkg.in/yaml.v1"
)
type Config struct {
Auth struct {
Username string
PasswordCmd string `yaml:"password_cmd"`
}
Fields struct {
PersonID uint `yaml:"person_id"`
Clients []struct {
ID uint
Name string
Projects []struct {
ID uint
Name string
Modules []struct {
ID uint
Name string
}
Tasks []struct {
ID uint
Name string
}
WorkTypes []struct {
ID uint
Name string
} `yaml:"work_types"`
}
}
}
}
func main() {
config_str, err := ioutil.ReadFile("config.yml")
config := Config{}
err = yaml.Unmarshal(config_str, &config)
if err != nil {
log.Println(err)
}
log.Printf("%+v", config)
}
|