Browse Source

filter .json in confDir

vcptr 5 years ago
parent
commit
c3f55dcd67
2 changed files with 6 additions and 2 deletions
  1. 3 1
      infra/control/config.go
  2. 3 1
      main/main.go

+ 3 - 1
infra/control/config.go

@@ -41,7 +41,9 @@ func (c *ConfigCommand) Execute(args []string) error {
 		r, err := c.LoadArg(arg)
 		common.Must(err)
 		c, err := serial.DecodeJSONConfig(r)
-		common.Must(err)
+		if err != nil {
+			ctllog.Fatalln(err)
+		}
 		conf.Override(c, arg)
 	}
 

+ 3 - 1
main/main.go

@@ -46,7 +46,9 @@ func readConfDir(dirPath string) {
 		log.Fatalln(err)
 	}
 	for _, f := range confs {
-		configFiles.Set(path.Join(dirPath, f.Name()))
+		if strings.HasSuffix(f.Name(), ".json") {
+			configFiles.Set(path.Join(dirPath, f.Name()))
+		}
 	}
 }