From f0b01c6396cb7b222ce59e0d7fa648303d63c39b Mon Sep 17 00:00:00 2001
From: cjp <cjp_ca@163.com>
Date: Wed, 3 Feb 2021 01:00:22 +0800
Subject: [PATCH] mod keep the original way to get the path of the
 configuration file

---
 common/logger/logger.go | 9 +++++++--
 config/config_loader.go | 8 ++++----
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/common/logger/logger.go b/common/logger/logger.go
index 3711d4908..8519543c6 100644
--- a/common/logger/logger.go
+++ b/common/logger/logger.go
@@ -33,6 +33,10 @@ import (
 	"gopkg.in/yaml.v2"
 )
 
+import (
+	"github.com/apache/dubbo-go/common/constant"
+)
+
 var (
 	logger Logger
 )
@@ -61,8 +65,9 @@ func init() {
 	if logger != nil {
 		return
 	}
-	fs := flag.NewFlagSet("log_config", flag.ContinueOnError)
-	logConfFile := fs.String("logConf", "", "default log config path")
+
+	fs := flag.NewFlagSet("log", flag.ContinueOnError)
+	logConfFile := fs.String("logConf", os.Getenv(constant.APP_LOG_CONF_FILE), "default log config path")
 	fs.Parse(os.Args[1:])
 	for len(fs.Args()) != 0 {
 		fs.Parse(fs.Args()[1:])
diff --git a/config/config_loader.go b/config/config_loader.go
index f2a61cfb2..12f57ee76 100644
--- a/config/config_loader.go
+++ b/config/config_loader.go
@@ -64,10 +64,10 @@ func init() {
 		confProFile string
 	)
 
-	fs := flag.NewFlagSet("config_loader", flag.ContinueOnError)
-	fs.StringVar(&confConFile, "conConf", "", "default client config path")
-	fs.StringVar(&confProFile, "proConf", "", "default server config path")
-	fs.StringVar(&confRouterFile, "rouConf", "", "default router config path")
+	fs := flag.NewFlagSet("config", flag.ContinueOnError)
+	fs.StringVar(&confConFile, "conConf", os.Getenv(constant.CONF_CONSUMER_FILE_PATH), "default client config path")
+	fs.StringVar(&confProFile, "proConf", os.Getenv(constant.CONF_PROVIDER_FILE_PATH), "default server config path")
+	fs.StringVar(&confRouterFile, "rouConf", os.Getenv(constant.CONF_ROUTER_FILE_PATH), "default router config path")
 	fs.Parse(os.Args[1:])
 	for len(fs.Args()) != 0 {
 		fs.Parse(fs.Args()[1:])
-- 
GitLab