Skip to content

Commit

Permalink
[#1573]remove rootpath field in nacos&add ZkDefaultGroup constant
Browse files Browse the repository at this point in the history
  • Loading branch information
dongjianhui03 committed Nov 9, 2021
1 parent e785d0d commit 2cb57ab
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
6 changes: 3 additions & 3 deletions config_center/dynamic_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ import (
// DynamicConfiguration
// ////////////////////////////////////////
const (
// DEFAULT_GROUP: default group
// DEFAULT_GROUP default group
DEFAULT_GROUP = "dubbo"
// DEFAULT_CONFIG_TIMEOUT: default config timeout
DEFAULT_CONFIG_TIMEOUT = "10s"
// ZK_DEFAULT_GROUP default group of zk
ZK_DEFAULT_GROUP = "dubbo"
)

// DynamicConfiguration for modify listener and get properties file
Expand Down
9 changes: 3 additions & 6 deletions config_center/nacos/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (

import (
"github.com/apache/dubbo-go/common"
"github.com/apache/dubbo-go/common/constant"
"github.com/apache/dubbo-go/common/logger"
"github.com/apache/dubbo-go/config_center"
"github.com/apache/dubbo-go/config_center/parser"
Expand All @@ -49,7 +48,6 @@ const (
type nacosDynamicConfiguration struct {
config_center.BaseDynamicConfiguration
url *common.URL
rootPath string
wg sync.WaitGroup
cltLock sync.Mutex
done chan struct{}
Expand All @@ -60,13 +58,12 @@ type nacosDynamicConfiguration struct {

func newNacosDynamicConfiguration(url *common.URL) (*nacosDynamicConfiguration, error) {
c := &nacosDynamicConfiguration{
rootPath: "/" + url.GetParam(constant.CONFIG_NAMESPACE_KEY, config_center.DEFAULT_GROUP) + "/config",
url: url,
done: make(chan struct{}),
url: url,
done: make(chan struct{}),
}
err := ValidateNacosClient(c)
if err != nil {
logger.Errorf("nacos client start error ,error message is %v", err)
logger.Errorf("nacos client start error, error message is %v", err)
return nil, err
}
c.wg.Add(1)
Expand Down
6 changes: 3 additions & 3 deletions config_center/zookeeper/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ type zookeeperDynamicConfiguration struct {
func newZookeeperDynamicConfiguration(url *common.URL) (*zookeeperDynamicConfiguration, error) {
c := &zookeeperDynamicConfiguration{
url: url,
rootPath: "/" + url.GetParam(constant.CONFIG_NAMESPACE_KEY, config_center.DEFAULT_GROUP) + "/config",
rootPath: "/" + url.GetParam(constant.CONFIG_NAMESPACE_KEY, config_center.ZK_DEFAULT_GROUP) + "/config",
}
err := zookeeper.ValidateZookeeperClient(c, ZkClient)
if err != nil {
logger.Errorf("zookeeper client start error ,error message is %v", err)
logger.Errorf("zookeeper client start error, error message is %v", err)
return nil, err
}
c.wg.Add(1)
Expand Down Expand Up @@ -227,7 +227,7 @@ func (c *zookeeperDynamicConfiguration) getPath(key string, group string) string

func (c *zookeeperDynamicConfiguration) buildPath(group string) string {
if len(group) == 0 {
group = config_center.DEFAULT_GROUP
group = config_center.ZK_DEFAULT_GROUP
}
return c.rootPath + pathSeparator + group
}

0 comments on commit 2cb57ab

Please sign in to comment.