|
@@ -1,11 +1,13 @@
|
|
|
package c_nacos
|
|
|
|
|
|
import (
|
|
|
+ "cicv-data-closedloop/plugin-compile/package/config/c_log"
|
|
|
"fmt"
|
|
|
"github.com/nacos-group/nacos-sdk-go/v2/clients"
|
|
|
"github.com/nacos-group/nacos-sdk-go/v2/clients/naming_client"
|
|
|
"github.com/nacos-group/nacos-sdk-go/v2/common/constant"
|
|
|
"github.com/nacos-group/nacos-sdk-go/v2/vo"
|
|
|
+ "os"
|
|
|
)
|
|
|
|
|
|
var (
|
|
@@ -29,11 +31,7 @@ func InitNacos() {
|
|
|
//create ClientConfig
|
|
|
cc := *constant.NewClientConfig(
|
|
|
constant.WithNamespaceId(namespaceId),
|
|
|
- constant.WithTimeoutMs(5000),
|
|
|
constant.WithNotLoadCacheAtStart(true),
|
|
|
- constant.WithLogDir("/tmp/nacos/log"),
|
|
|
- constant.WithCacheDir("/tmp/nacos/cache"),
|
|
|
- constant.WithLogLevel("debug"),
|
|
|
constant.WithUsername(username),
|
|
|
constant.WithPassword(password),
|
|
|
)
|
|
@@ -47,7 +45,8 @@ func InitNacos() {
|
|
|
)
|
|
|
|
|
|
if err != nil {
|
|
|
- panic(err)
|
|
|
+ c_log.GlobalLogger.Error("程序崩溃,nacos连接失败:", err)
|
|
|
+ os.Exit(-1)
|
|
|
}
|
|
|
|
|
|
//Register
|