From a2ccb6c190acbd26de5d29d2c21bc53b39032ded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=92=E9=87=8E=E7=84=A1=E7=87=88?= Date: Tue, 15 Jan 2019 23:41:06 +0800 Subject: [PATCH] frpc: fixup ini config parse problem in sub command `status` and `reload`. --- cmd/frpc/sub/reload.go | 9 ++++++++- cmd/frpc/sub/status.go | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/cmd/frpc/sub/reload.go b/cmd/frpc/sub/reload.go index 1e6f2c4..a05c309 100644 --- a/cmd/frpc/sub/reload.go +++ b/cmd/frpc/sub/reload.go @@ -27,6 +27,7 @@ import ( "github.com/fatedier/frp/client" "github.com/fatedier/frp/g" + "github.com/fatedier/frp/models/config" ) func init() { @@ -37,7 +38,13 @@ var reloadCmd = &cobra.Command{ Use: "reload", Short: "Hot-Reload frpc configuration", RunE: func(cmd *cobra.Command, args []string) error { - err := parseClientCommonCfg(CfgFileTypeIni, cfgFile) + iniContent, err := config.GetRenderedConfFromFile(cfgFile) + if err != nil { + fmt.Println(err) + os.Exit(1) + } + + err = parseClientCommonCfg(CfgFileTypeIni, iniContent) if err != nil { fmt.Println(err) os.Exit(1) diff --git a/cmd/frpc/sub/status.go b/cmd/frpc/sub/status.go index 3a25a4b..883c7a7 100644 --- a/cmd/frpc/sub/status.go +++ b/cmd/frpc/sub/status.go @@ -28,6 +28,7 @@ import ( "github.com/fatedier/frp/client" "github.com/fatedier/frp/g" + "github.com/fatedier/frp/models/config" ) func init() { @@ -38,7 +39,13 @@ var statusCmd = &cobra.Command{ Use: "status", Short: "Overview of all proxies status", RunE: func(cmd *cobra.Command, args []string) error { - err := parseClientCommonCfg(CfgFileTypeIni, cfgFile) + iniContent, err := config.GetRenderedConfFromFile(cfgFile) + if err != nil { + fmt.Println(err) + os.Exit(1) + } + + err = parseClientCommonCfg(CfgFileTypeIni, iniContent) if err != nil { fmt.Println(err) os.Exit(1)