-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalues.go
More file actions
46 lines (34 loc) · 793 Bytes
/
Copy pathvalues.go
File metadata and controls
46 lines (34 loc) · 793 Bytes
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
package main
import (
"encoding/json"
"gopkg.in/yaml.v2"
"io/ioutil"
"log"
)
func prepareTemplateValues(envName string) map[string]interface{} {
var templateValues map[string]interface{}
decodedValues := []byte(envName)
err := json.Unmarshal(decodedValues, &templateValues)
if err != nil {
log.Fatalln("error:", err)
}
return templateValues
}
func getConf(fileName string) map[string]interface{} {
var conf map[string]interface{}
yamlFile, err := ioutil.ReadFile(fileName)
if err != nil {
log.Printf("yamlFile.Get err #%v ", err)
}
err = yaml.Unmarshal(yamlFile, &conf)
if err != nil {
log.Fatalf("Unmarshal: %v", err)
}
return conf
}
func mergeValues(a, b map[string]interface{}) map[string]interface{} {
for k, v := range b {
a[k] = v
}
return a
}