This is an automated email from the ASF dual-hosted git repository.
baerwang pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go-pixiu.git
The following commit(s) were added to refs/heads/develop by this push:
new e580053e fix: Fix four fields(dataid, group, username, passwd) were
not passed bug, when uses nacos as remote config center (#679)
e580053e is described below
commit e580053e6b6a90d7615f4ff5d3c59b802fce6ce2
Author: Alan <[email protected]>
AuthorDate: Tue May 27 19:49:19 2025 +0800
fix: Fix four fields(dataid, group, username, passwd) were not passed bug,
when uses nacos as remote config center (#679)
* refactor: simplify client configuration initialization in nacos_load.go
* fix: set DataId and Group in configuration options for Nacos bootstrap
---
configcenter/nacos_load.go | 20 +++++++++++---------
pkg/config/config_load.go | 2 ++
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/configcenter/nacos_load.go b/configcenter/nacos_load.go
index 3fa8013a..40ea62a5 100644
--- a/configcenter/nacos_load.go
+++ b/configcenter/nacos_load.go
@@ -90,17 +90,19 @@ func getNacosConfigClient(boot *model.Bootstrap)
(config_client.IConfigClient, e
})
}
- clientConfig := constant.ClientConfig{
- NamespaceId: boot.Nacos.ClientConfig.NamespaceId,
- TimeoutMs: boot.Nacos.ClientConfig.TimeoutMs,
- NotLoadCacheAtStart:
boot.Nacos.ClientConfig.NotLoadCacheAtStart,
- LogDir: boot.Nacos.ClientConfig.LogDir,
- CacheDir: boot.Nacos.ClientConfig.CacheDir,
- LogLevel: boot.Nacos.ClientConfig.LogLevel,
- }
+ clientConfig := constant.NewClientConfig(
+ constant.WithUsername(boot.Nacos.ClientConfig.Username),
+ constant.WithPassword(boot.Nacos.ClientConfig.Password),
+ constant.WithNamespaceId(boot.Nacos.ClientConfig.NamespaceId),
+ constant.WithTimeoutMs(boot.Nacos.ClientConfig.TimeoutMs),
+
constant.WithNotLoadCacheAtStart(boot.Nacos.ClientConfig.NotLoadCacheAtStart),
+ constant.WithLogDir(boot.Nacos.ClientConfig.LogDir),
+ constant.WithCacheDir(boot.Nacos.ClientConfig.CacheDir),
+ constant.WithLogLevel(boot.Nacos.ClientConfig.LogLevel),
+ )
clientParam := vo.NacosClientParam{
- ClientConfig: &clientConfig,
+ ClientConfig: clientConfig,
ServerConfigs: serverConfigs,
}
diff --git a/pkg/config/config_load.go b/pkg/config/config_load.go
index 6c5c3033..c88cab10 100644
--- a/pkg/config/config_load.go
+++ b/pkg/config/config_load.go
@@ -235,6 +235,8 @@ func (m *ConfigManager) loadRemoteBootConfigs()
*model.Bootstrap {
configs, err := m.load.LoadConfigs(
bootstrap, func(opt *configcenter.Options) {
opt.Remote = true
+ opt.DataId = bootstrap.Nacos.DataId
+ opt.Group = bootstrap.Nacos.Group
},
)