Skip to content
This repository was archived by the owner on May 19, 2020. It is now read-only.

Commit bb9b1a8

Browse files
committed
handling config file errors
1 parent 75e1075 commit bb9b1a8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

reader.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,15 @@ func ReadConfigs(cfgPath string) ([]byte, error) {
7272
configs := make(map[string]map[string]interface{})
7373
for folder, files := range fileList {
7474
for _, file := range files {
75-
configBytes, _ := ioutil.ReadFile(cfgPath + "/" + folder + "/" + file)
75+
configBytes, err := ioutil.ReadFile(cfgPath + "/" + folder + "/" + file)
76+
if err != nil {
77+
log.Fatalf("[config] Error reading config file %s: %v", cfgPath+"/"+folder+"/"+file, err)
78+
}
7679

7780
var configFromFile map[string]map[string]interface{}
7881

7982
if err = yaml.Unmarshal(configBytes, &configFromFile); err != nil {
80-
log.Fatalf("[config] %s %s config read fal! Fall down.", folder, file)
83+
log.Fatalf("[config] %s %s config read fail! Fall down.", folder, file)
8184
}
8285

8386
if _, ok := configFromFile[folder]; !ok {

0 commit comments

Comments
 (0)