blob: c71d2870e5d4dd0ca65975b422005e56353b1b44 (
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
|
package main
import (
"gopkg.in/yaml.v2"
"io/ioutil"
"log"
)
type CompCfg struct {
Name string `yaml:"Name"`
URL string `yaml:"URL"`
}
type Suite struct {
Name string `yaml:"Name"`
Components []CompCfg `yaml:"Components"`
}
type ReleaseCfg struct {
Release string `yaml:"Release"`
RepoURL string `yaml:"RepoURL"`
Suites []Suite `yaml:"Suites"`
}
type PkgwebCfg struct {
PkgSets []ReleaseCfg `yaml:"PkgSets"`
}
func readConfig(fname string) *PkgwebCfg {
data, err := ioutil.ReadFile(fname)
if err != nil {
log.Fatal("Error while reading file: ", err)
}
cfg := new(PkgwebCfg)
err = yaml.Unmarshal(data, cfg)
if err != nil {
log.Fatal("Error while reading configuration: ", err)
}
return cfg
}
|