Skip to content

Commit

Permalink
mod keep the original way to get the path of the configuration file
Browse files Browse the repository at this point in the history
  • Loading branch information
cjphaha committed Feb 2, 2021
1 parent ebac2ce commit f0b01c6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
9 changes: 7 additions & 2 deletions common/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ import (
"gopkg.in/yaml.v2"
)

import (
"github.com/apache/dubbo-go/common/constant"
)

var (
logger Logger
)
Expand Down Expand Up @@ -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:])
Expand Down
8 changes: 4 additions & 4 deletions config/config_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:])
Expand Down

0 comments on commit f0b01c6

Please sign in to comment.