From b87df569e7645ebd5945e9d567ecde6c9ce60e4f Mon Sep 17 00:00:00 2001 From: hanshuai Date: Sat, 28 Apr 2018 00:30:13 +0800 Subject: [PATCH] do not ignore config parsing error --- cmd/frps/root.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cmd/frps/root.go b/cmd/frps/root.go index 38d6acb2..06a1f776 100644 --- a/cmd/frps/root.go +++ b/cmd/frps/root.go @@ -82,13 +82,17 @@ var rootCmd = &cobra.Command{ return nil } + var err error if cfgFile != "" { - parseServerCommonCfg(CfgFileTypeIni, cfgFile) + err = parseServerCommonCfg(CfgFileTypeIni, cfgFile) } else { - parseServerCommonCfg(CfgFileTypeCmd, "") + err = parseServerCommonCfg(CfgFileTypeCmd, "") + } + if err != nil { + return err } - err := runServer() + err = runServer() if err != nil { fmt.Println(err) os.Exit(1) @@ -113,7 +117,7 @@ func parseServerCommonCfg(fileType int, filePath string) (err error) { return } - g.GlbServerCfg.CfgFile = cfgFile + g.GlbServerCfg.CfgFile = filePath err = g.GlbServerCfg.ServerCommonConf.Check() if err != nil {