|
|
|
@ -2,11 +2,11 @@ package nacos_viper_remote
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"github.com/nacos-group/nacos-sdk-go/v2/clients"
|
|
|
|
|
"github.com/nacos-group/nacos-sdk-go/v2/clients/config_client"
|
|
|
|
|
"github.com/nacos-group/nacos-sdk-go/v2/common/constant"
|
|
|
|
|
"github.com/nacos-group/nacos-sdk-go/v2/common/logger"
|
|
|
|
|
"github.com/nacos-group/nacos-sdk-go/v2/vo"
|
|
|
|
|
"github.com/nacos-group/nacos-sdk-go/clients"
|
|
|
|
|
"github.com/nacos-group/nacos-sdk-go/clients/config_client"
|
|
|
|
|
"github.com/nacos-group/nacos-sdk-go/common/constant"
|
|
|
|
|
"github.com/nacos-group/nacos-sdk-go/common/logger"
|
|
|
|
|
"github.com/nacos-group/nacos-sdk-go/vo"
|
|
|
|
|
"github.com/spf13/viper"
|
|
|
|
|
"strings"
|
|
|
|
|
)
|
|
|
|
@ -30,8 +30,8 @@ func NewNacosConfigManager(option *Option) (*nacosConfigManager, error) {
|
|
|
|
|
NamespaceId: option.NamespaceId,
|
|
|
|
|
TimeoutMs: 5000,
|
|
|
|
|
NotLoadCacheAtStart: true,
|
|
|
|
|
LogDir: "logs/nacos/log",
|
|
|
|
|
CacheDir: "logs/nacos/cache",
|
|
|
|
|
RotateTime: "1h",
|
|
|
|
|
MaxAge: 3,
|
|
|
|
|
LogLevel: "info",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -44,7 +44,10 @@ func NewNacosConfigManager(option *Option) (*nacosConfigManager, error) {
|
|
|
|
|
clientConfig.SecretKey = option.Auth.SecretKey
|
|
|
|
|
clientConfig.OpenKMS = option.Auth.OpenKMS
|
|
|
|
|
}
|
|
|
|
|
client, err := clients.NewConfigClient(vo.NacosClientParam{ClientConfig: &clientConfig, ServerConfigs: serverConfigs})
|
|
|
|
|
client, err := clients.CreateConfigClient(map[string]interface{}{
|
|
|
|
|
"serverConfigs": serverConfigs,
|
|
|
|
|
"clientConfig": clientConfig,
|
|
|
|
|
})
|
|
|
|
|
if err != nil {
|
|
|
|
|
logger.Error(err.Error())
|
|
|
|
|
return nil, err
|
|
|
|
|