You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
kratos/contrib/config/nacos
包子 a672980a15
fix: upgrade go.sum (#2715)
2 years ago
..
README.md style(contrib/config): code style modify (#2475) 2 years ago
config.go test(nacos): add nacos unit test and remove unused function (#2145) 3 years ago
config_test.go test(nacos): add nacos unit test and remove unused function (#2145) 3 years ago
go.mod feat: add subset alg for instances (#2613) 2 years ago
go.sum fix: upgrade go.sum (#2715) 2 years ago
watcher.go fix: fmt import (#2379) 2 years ago

README.md

Nacos Config

import (
	"github.com/nacos-group/nacos-sdk-go/clients"
	"github.com/nacos-group/nacos-sdk-go/common/constant"

	kconfig "github.com/go-kratos/kratos/v2/config"
)


sc := []constant.ServerConfig{
	*constant.NewServerConfig("127.0.0.1", 8848),
}

cc := &constant.ClientConfig{
	NamespaceId:         "public", //namespace id
	TimeoutMs:           5000,
	NotLoadCacheAtStart: true,
	LogDir:              "/tmp/nacos/log",
	CacheDir:            "/tmp/nacos/cache",
	RotateTime:          "1h",
	MaxAge:              3,
	LogLevel:            "debug",
}

// a more graceful way to create naming client
client, err := clients.NewConfigClient(
	vo.NacosClientParam{
		ClientConfig:  cc,
		ServerConfigs: sc,
	},
)
if err != nil {
	log.Panic(err)
}