feat: registry.

This commit is contained in:
Bobo
2025-06-02 11:58:11 +08:00
parent 59c731904a
commit 0759f2d752
3 changed files with 159 additions and 133 deletions

View File

@@ -21,15 +21,30 @@ func NewRegistry(c *conf.Registry) *Registry {
}
cliConf := nacosConstant.ClientConfig{
NamespaceId: c.Nacos.NamespaceId,
TimeoutMs: uint64(c.Nacos.Timeout.AsDuration().Milliseconds()), // http请求超时时间单位毫秒
BeatInterval: c.Nacos.BeatInterval.AsDuration().Milliseconds(), // 心跳间隔时间,单位毫秒
UpdateThreadNum: int(c.Nacos.UpdateThreadNum), // 更新服务的线程数
NamespaceId: c.Nacos.NamespaceId,
RegionId: c.Nacos.RegionId, // 地域ID
AppName: c.Nacos.AppName,
AppKey: c.Nacos.AppKey,
TimeoutMs: uint64(c.Nacos.Timeout.AsDuration().Milliseconds()), // http请求超时时间单位毫秒
BeatInterval: c.Nacos.BeatInterval.AsDuration().Milliseconds(), // 心跳间隔时间,单位毫秒
UpdateThreadNum: int(c.Nacos.UpdateThreadNum), // 更新服务的线程数
LogLevel: c.Nacos.LogLevel,
CacheDir: c.Nacos.CacheDir, // 缓存目录
LogDir: c.Nacos.LogDir, // 日志目录
NotLoadCacheAtStart: c.Nacos.NotLoadCacheAtStart, // 在启动时不读取本地缓存数据true--不读取false--读取
UpdateCacheWhenEmpty: c.Nacos.UpdateCacheWhenEmpty, // 当服务列表为空时是否更新本地缓存true--更新,false--不更新
Username: c.Nacos.Username,
Password: c.Nacos.Password,
OpenKMS: c.Nacos.OpenKms, // 是否开启KMS加密
AccessKey: c.Nacos.AccessKey, // 阿里云AccessKey
SecretKey: c.Nacos.SecretKey, // 阿里云SecretKey
ContextPath: c.Nacos.ContextPath,
}
cli, err := nacosClients.NewNamingClient(