From c3f55dcd678f18a983c85f90a6f6a9adc1cced29 Mon Sep 17 00:00:00 2001 From: vcptr <51714622+vcptr@users.noreply.github.com> Date: Tue, 31 Dec 2019 13:11:34 +0800 Subject: [PATCH] filter .json in confDir --- infra/control/config.go | 4 +++- main/main.go | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/infra/control/config.go b/infra/control/config.go index 8fca11b0b..504975a8c 100644 --- a/infra/control/config.go +++ b/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) } diff --git a/main/main.go b/main/main.go index 2d6f2f803..298e97d12 100644 --- a/main/main.go +++ b/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())) + } } }