提交 4970d53d authored 作者: mooncake9527's avatar mooncake9527

upd

上级 5c90f99a
......@@ -6,8 +6,6 @@ import (
"time"
"github.com/jinzhu/copier"
"gitlab.wanzhuangkj.com/tush/xpkg/onacos"
"gitlab.wanzhuangkj.com/tush/xpkg/rd/nacos"
alioss "gitlab.wanzhuangkj.com/tush/xpkg/third/alioss"
)
......@@ -16,14 +14,22 @@ var Cfg = &Config{
}
type ICfg interface {
Lock()
Unlock()
RLock()
RUnlock()
IRWLock
GetContent() []byte
SetContent(content []byte)
}
type IRWLock interface {
ILock
RLock()
RUnlock()
}
type ILock interface {
Lock()
Unlock()
}
func Write(f func(c *Config)) {
if Cfg == nil {
panic("config is nil, please call config.Init() first")
......@@ -91,10 +97,10 @@ type Config struct {
App App `yaml:"app" json:"app"`
Auth Auth `yaml:"auth" json:"auth"`
ConfType string `yaml:"confType" json:"confType"`
Local Local `yaml:"-" json:"local"`
Consul Consul `yaml:"-" json:"consul"`
Nacos onacos.NacosConfig `yaml:"nacos" json:"nacos"`
ConfType string `yaml:"confType" json:"confType"` // local, consul, nacos
ConfCenter ConfCenter `yaml:"-" json:"-"`
Rd Rd `yaml:"rd" json:"rd"` // 注册中心
Database []Database `yaml:"database" json:"database"`
Etcd Etcd `yaml:"etcd" json:"etcd"`
......@@ -108,11 +114,21 @@ type Config struct {
CronJobs Cron `yaml:"cron" json:"cron"`
Leaf Leaf `yaml:"leaf" json:"leaf"`
NacosConfClient *NacosClient `yaml:"-" json:"-"`
NacosNamingClient *nacos.NacosNamingClient `yaml:"-" json:"-"`
AliOss alioss.AliOssConfig `yaml:"oss" json:"oss"`
Content []byte `yaml:"-" json:"-"`
}
// 选择哪个配置中心
type ConfCenter struct {
Local Local `yaml:"-" json:"local"`
Nacos NacosConfConfig `yaml:"nacos" json:"nacos"`
Consul Consul `yaml:"-" json:"consul"`
}
type Rd struct {
Nacos NacosSvcConfig `yaml:"nacos" json:"nacos"`
}
func (x *Config) GetContent() []byte {
x.l.RLock()
defer x.l.RUnlock()
......@@ -207,11 +223,12 @@ type App struct {
Env string `yaml:"env" json:"env"`
Host string `yaml:"host" json:"host"`
Name string `yaml:"name" json:"name"`
RegistryDiscoveryType string `yaml:"registryDiscoveryType" json:"registryDiscoveryType"`
RegistryDiscoveryType string `yaml:"registryDiscoveryType" json:"registryDiscoveryType"` // e.g. nacos, consul , close if empty
TracingSamplingRate float64 `yaml:"tracingSamplingRate" json:"tracingSamplingRate"`
Version string `yaml:"version" json:"version"`
IPRateLimiter IPRateLimiter `yaml:"ipRateLimiter" json:"ipRateLimiter"`
HideSensitiveFields string `yaml:"hideSensitiveFields" json:"hideSensitiveFields"`
ConfPath string `yaml:"-" json:"confPath"`
PodName string `yaml:"-" json:"podName"`
WebLog WebLog `yaml:"webLog" json:"webLog"`
......
......@@ -34,14 +34,14 @@ func parse() (err error) {
Cfg.ConfType = confType
if confType == "local" {
localConf()
logger.Infof("[conf]conf:%s", Cfg.Local.Conf)
return parseLocal(Cfg.Local.Conf, Cfg, func() {
logger.Infof("[conf]conf:%s", Cfg.ConfCenter.Local.Conf)
return parseLocal(Cfg.ConfCenter.Local.Conf, Cfg, func() {
ParseExtend()
})
}
if confType == "consul" {
consulConf()
confKey := Cfg.Consul.Conf
confKey := Cfg.ConfCenter.Consul.Conf
logger.Infof("[conf]conf:%s", confKey)
return NewFetcher(confKey, Cfg, func(conf []byte) {
ParseExtend()
......@@ -49,7 +49,7 @@ func parse() (err error) {
}
if confType == "nacos" {
nacosConf()
nc := NewNacos(&Cfg.Nacos, func(content []byte) (err error) {
nc := NewNacos(&Cfg.ConfCenter.Nacos, func(content []byte) (err error) {
Cfg.SetContent(content)
v := viper.New()
v.SetConfigType("yaml")
......@@ -59,7 +59,6 @@ func parse() (err error) {
if err := v.Unmarshal(&Cfg); err != nil {
return err
}
logger.Debug("[conf]parse conf", logger.Any("conf", Cfg))
return ParseExtend()
}, logger.Get())
if err := nc.Connect().Watch().Fetch().Parse().Err(); err != nil {
......@@ -84,11 +83,12 @@ func ParseExtend() error {
if extend != nil {
if subv := v.Sub("extend"); subv != nil {
extend.Lock()
defer extend.Unlock()
if err := subv.Unmarshal(extend); err != nil {
extend.Unlock()
return err
}
logger.Debug("[conf]parse extend", logger.Any("extend", extend))
extend.Unlock()
logger.Debug(ShowObj(extend))
}
}
return nil
......@@ -97,7 +97,7 @@ func ParseExtend() error {
func localConf() {
confFile := readEnvVarWithDefault("CONF_FILES", "./conf/conf.yaml")
Write(func(c *Config) {
c.Local.Conf = confFile
c.ConfCenter.Local.Conf = confFile
})
}
......@@ -109,31 +109,29 @@ func nacosConf() {
dataID := readEnvVarWithDefault("NACOS_DATA_ID", "conf.yaml")
group := readEnvVarWithDefault("NACOS_GROUP", "DEFAULT_GROUP")
logger.Infof("[conf]conf host:%s namespace:%s dataId:%s group:%s", host, namespace, dataID, group)
Cfg.Nacos.IPs = strings.Split(host, ",")
Cfg.Nacos.Port = cast.ToInt(port)
Cfg.Nacos.Conf.Namespace = namespace
Cfg.Nacos.Conf.DataID = dataID
Cfg.Nacos.Conf.Group = group
Cfg.Nacos.Conf.ContextPath = contextPath
Cfg.Nacos.Rd.GroupName = group
Cfg.ConfCenter.Nacos.IPs = strings.Split(host, ",")
Cfg.ConfCenter.Nacos.Port = cast.ToInt(port)
Cfg.ConfCenter.Nacos.Namespace = namespace
Cfg.ConfCenter.Nacos.DataID = dataID
Cfg.ConfCenter.Nacos.Group = group
Cfg.ConfCenter.Nacos.ContextPath = contextPath
}
func consulConf() {
if confFile := os.Getenv("CONSUL_CONFIG_FILES"); confFile != "" {
Write(func(c *Config) {
c.Consul.Conf = confFile
c.ConfCenter.Consul.Conf = confFile
})
}
if addr := os.Getenv("CONSUL_HTTP_ADDR"); addr != "" {
Write(func(c *Config) {
c.Consul.Addr = addr
c.ConfCenter.Consul.Addr = addr
})
}
if token := os.Getenv("CONSUL_HTTP_TOKEN"); token != "" {
Write(func(c *Config) {
c.Consul.Token = token
c.ConfCenter.Consul.Token = token
})
}
}
......
......@@ -78,30 +78,51 @@ func Show(hiddenFields ...string) string {
return show(Cfg, hiddenFields...)
}
func ShowObj(obj ILock, hiddenFields ...string) string {
return show(obj, hiddenFields...)
}
// Show print configuration information (hide sensitive fields)
func show(obj ICfg, fields ...string) string {
func show(obj ILock, fields ...string) string {
var out string
obj.RLock()
obj.Lock()
data, err := json.MarshalIndent(obj, "", " ")
if err != nil {
obj.RUnlock()
obj.Unlock()
fmt.Println("json.MarshalIndent error: ", err)
return ""
}
obj.RUnlock()
obj.Unlock()
hsf := Cfg.App.HideSensitiveFields
if hsf != "" {
words := strings.Split(hsf, ",")
if len(words) > 0 {
wordsHide := make([]string, 0, len(words))
for _, word := range words {
word = strings.TrimSpace(word)
if word != "" {
wordsHide = append(wordsHide, fmt.Sprintf(`"%s"`, word))
}
}
fields = append(fields, wordsHide...)
}
}
buf := bufio.NewReader(bytes.NewReader(data))
for {
line, err := buf.ReadString('\n')
if err != nil {
break
}
fields = append(fields, `“SignKey”,"dsn"`, `"password"`, `"pwd"`, `"signKey"`, `"access-key-id"`, `"access-key-secret"`)
fields = append(fields, `“SignKey”`, `"dsn"`, `"password"`, `"pwd"`, `"signKey"`, `"access-key-id"`, `"access-key-secret"`)
out += HideSensitiveFields(line, fields...)
}
return out
}
func HideSensitiveFields(line string, fields ...string) string {
if strings.Contains(line, "hideSensitiveFields:") {
return line
}
for _, field := range fields {
if strings.Contains(line, field) {
index := strings.Index(line, field)
......@@ -111,7 +132,6 @@ func HideSensitiveFields(line string, fields ...string) string {
return fmt.Sprintf("%s: \"******\",\n", line[:index+len(field)])
}
}
// replace dsn
if strings.Contains(line, "@") && strings.Contains(line, ":") {
return replaceDSN(line)
......
......@@ -7,14 +7,13 @@ import (
"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/vo"
"gitlab.wanzhuangkj.com/tush/xpkg/onacos"
"go.uber.org/zap"
)
type NacosClient struct {
cc *constant.ClientConfig
sc []constant.ServerConfig
cfg *onacos.NacosConfig
cfg *NacosConfConfig
cli config_client.IConfigClient
content []byte
parseFn func(content []byte) (err error)
......@@ -24,7 +23,7 @@ type NacosClient struct {
type Parser func(content []byte) (err error)
func NewNacos(cfg *onacos.NacosConfig, p Parser, l *zap.Logger) *NacosClient {
func NewNacos(cfg *NacosConfConfig, p Parser, l *zap.Logger) *NacosClient {
nc := NacosClient{}
nc.cfg = cfg
nc.parseFn = p
......@@ -53,7 +52,7 @@ func (x *NacosClient) Connect() *NacosClient {
return x
}
x.cc = constant.NewClientConfig(
constant.WithNamespaceId(x.cfg.Conf.Namespace), // 命名空间ID
constant.WithNamespaceId(x.cfg.Namespace), // 命名空间ID
constant.WithTimeoutMs(5000), // 请求超时时间
constant.WithNotLoadCacheAtStart(false), // 启动时不读取缓存
constant.WithLogDir("/tmp/nacos/log"), // 日志目录
......@@ -66,7 +65,7 @@ func (x *NacosClient) Connect() *NacosClient {
serverConfig := constant.NewServerConfig(
ip, // Nacos服务地址
uint64(x.cfg.Port), // Nacos服务端口
constant.WithContextPath(x.cfg.Conf.ContextPath),
constant.WithContextPath(x.cfg.ContextPath),
)
serverConfigs = append(serverConfigs, *serverConfig)
}
......@@ -82,7 +81,7 @@ func (x *NacosClient) Fetch() *NacosClient {
return x
}
var content string
if content, x.e = x.cli.GetConfig(vo.ConfigParam{DataId: x.cfg.Conf.DataID, Group: x.cfg.Conf.Group}); x.e != nil {
if content, x.e = x.cli.GetConfig(vo.ConfigParam{DataId: x.cfg.DataID, Group: x.cfg.Group}); x.e != nil {
return x
} else {
x.content = []byte(content)
......@@ -103,8 +102,8 @@ func (x *NacosClient) Watch() *NacosClient {
return x
}
x.e = x.cli.ListenConfig(vo.ConfigParam{
DataId: x.cfg.Conf.DataID,
Group: x.cfg.Conf.Group,
DataId: x.cfg.DataID,
Group: x.cfg.Group,
OnChange: func(namespace, group, dataId, data string) {
fmt.Println("[nacos]conf changed")
x.content = []byte(data)
......
package config
type NacosConfConfig struct {
IPs []string `yaml:"ips" json:"ips"` // nacos server ip list
Port int `yaml:"port" json:"port"` // nacos server port
Namespace string `yaml:"namespace" json:"namespace"` // nacos namespace
ContextPath string `yaml:"context" json:"context"` // nacos server context path
DataID string `yaml:"dataId" json:"dataId"` // nacos config dataId
Group string `yaml:"group" json:"group"` // nacos config group
}
type NacosSvcConfig struct {
IPs []string `yaml:"ips" json:"ips"` // nacos server ip list
Port int `yaml:"port" json:"port"` // nacos server port
Context string `yaml:"context" json:"context"` // nacos server context path
Namespace string `yaml:"namespace" json:"namespace"` // nacos namespace
ServiceIP string `yaml:"serviceIP" json:"serviceIP"` // service instance ip
ServicePort int `yaml:"servicePort" json:"servicePort"` // service instance port
ServiceName string `yaml:"serviceName" json:"serviceName"` // service name
GroupName string `yaml:"groupName" json:"groupName"` // service group name
ClusterName string `yaml:"clusterName" json:"clusterName"` // service cluster name
Weight int `yaml:"weight" json:"weight"` // service instance weight
Enable bool `yaml:"enable" json:"enable"` // service instance enable
Healthy bool `yaml:"healthy" json:"healthy"` // service instance healthy
Ephemeral bool `yaml:"ephemeral" json:"ephemeral"` // service instance ephemeral
}
......@@ -3,21 +3,19 @@ package database
import (
"strings"
"sync"
"gitlab.wanzhuangkj.com/tush/xpkg/config"
"gitlab.wanzhuangkj.com/tush/xpkg/consts"
"gitlab.wanzhuangkj.com/tush/xpkg/logger"
"gitlab.wanzhuangkj.com/tush/xpkg/sgorm"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
)
var (
gdbs = make(map[string]*sgorm.DB)
gdbOnce sync.Once
ErrRecordNotFound = sgorm.ErrRecordNotFound
)
// InitDB connect database
func InitDB() (err error) {
var databases []config.Database
config.Read(func(c *config.Config) {
......@@ -37,6 +35,7 @@ func InitDB() (err error) {
consts.DefaultSchema = databases[0].Name
}
}
logger.Info("[database] default schema: " + consts.DefaultSchema)
for _, db := range databases {
switch strings.ToLower(db.Driver) {
case sgorm.DBDriverMysql, sgorm.DBDriverTidb:
......
......@@ -12,7 +12,6 @@ import (
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
// InitMysql connect mysql
func InitMysql(dbConfig *config.Database) (*sgorm.DB, error) {
enableTrace := false
config.Read(func(c *config.Config) {
......
......@@ -56,7 +56,6 @@ func newMemoryCache() *ristretto.Cache {
return cache
}
// InitRedis connect redis
func InitRedis() {
var redisCfg config.Redis
enableTrace := false
......@@ -81,7 +80,6 @@ func InitRedis() {
}
}
// GetRedisCli get redis client
func GetRedisCli() *goredis.Client {
if redisCli == nil {
redisCliOnce.Do(func() {
......@@ -91,7 +89,6 @@ func GetRedisCli() *goredis.Client {
return redisCli
}
// CloseRedis close redis
func CloseRedis() error {
return goredis.Close(redisCli)
}
package global
import "gitlab.wanzhuangkj.com/tush/xpkg/rd/nacos"
var (
NacosClient *nacos.NacosServiceClient
)
......@@ -9,6 +9,7 @@ import (
"gitlab.wanzhuangkj.com/tush/xpkg/config"
"gitlab.wanzhuangkj.com/tush/xpkg/database"
"gitlab.wanzhuangkj.com/tush/xpkg/eventbus"
"gitlab.wanzhuangkj.com/tush/xpkg/global"
"gitlab.wanzhuangkj.com/tush/xpkg/ips"
"gitlab.wanzhuangkj.com/tush/xpkg/logger"
"gitlab.wanzhuangkj.com/tush/xpkg/rd/nacos"
......@@ -16,7 +17,7 @@ import (
"gitlab.wanzhuangkj.com/tush/xpkg/tracer"
)
func Init() error {
func Init() (err error) {
conf := config.Cfg
if err := initLogger(conf); err != nil {
return err
......@@ -55,24 +56,32 @@ func Init() error {
if rdt == "nacos" {
localhost := ips.GetLocalHost()
config.Write(func(c *config.Config) {
c.Nacos.Rd.ServiceName = conf.App.Name
c.Nacos.Rd.IP = localhost
c.Nacos.Rd.Port = conf.HTTP.Port
c.Rd.Nacos.ServiceName = conf.App.Name
c.Rd.Nacos.ServiceIP = localhost
c.Rd.Nacos.ServicePort = conf.HTTP.Port
})
config.Read(func(c *config.Config) {
copier.Copy(&conf, c)
})
var nnc *nacos.NacosServiceClient
if conf.ConfType == "nacos" {
cc := conf.NacosConfClient.GetCC()
sc := conf.NacosConfClient.GetSC()
nnc, err := nacos.New(&conf.Nacos, cc, sc)
nnc, err = nacos.New(&conf.Rd.Nacos, cc, sc)
if err != nil {
return err
}
} else {
nnc, err = nacos.NewWithConfig(&conf.Rd.Nacos)
if err != nil {
return err
}
}
if err := nnc.Register(); err != nil {
return err
}
config.Write(func(c *config.Config) {
c.NacosNamingClient = nnc
global.NacosClient = nnc
})
}
eventbus.Eb.Publish(ctx, eventbus.TopicCoreInitFinish)
......
package onacos
type NacosConfig struct {
IPs []string `yaml:"ips" json:"ips"`
Port int `yaml:"port" json:"port"`
Conf NacosConfConfig `yaml:"conf" json:"conf"`
Rd NacosSvcConfig `yaml:"rd" json:"rd"`
}
type NacosConfConfig struct {
Namespace string `yaml:"namespace" json:"namespace"`
ContextPath string `yaml:"context" json:"context"`
DataID string `yaml:"dataId" json:"dataId"`
Group string `yaml:"group" json:"group"`
}
type NacosSvcConfig struct {
IP string `yaml:"ip" json:"ip"`
Port int `yaml:"port" json:"port"`
ServiceName string `yaml:"serviceName" json:"serviceName"`
GroupName string `yaml:"groupName" json:"groupName"`
ClusterName string `yaml:"clusterName" json:"clusterName"`
Weight int `yaml:"weight" json:"weight"`
Enable bool `yaml:"enable" json:"enable"`
Healthy bool `yaml:"healthy" json:"healthy"`
Ephemeral bool `yaml:"ephemeral" json:"ephemeral"`
}
package nacos
import (
"github.com/nacos-group/nacos-sdk-go/clients"
"github.com/nacos-group/nacos-sdk-go/clients/naming_client"
"github.com/nacos-group/nacos-sdk-go/common/constant"
"github.com/nacos-group/nacos-sdk-go/model"
"github.com/nacos-group/nacos-sdk-go/vo"
"gitlab.wanzhuangkj.com/tush/xpkg/config"
)
type NacosServiceClient struct {
cc *constant.ClientConfig
sc []constant.ServerConfig
cfg *config.NacosSvcConfig
cli naming_client.INamingClient
}
func NewWithConfig(cfg *config.NacosSvcConfig) (*NacosServiceClient, error) {
nnc := NacosServiceClient{
cfg: cfg,
}
serverConfigs := make([]constant.ServerConfig, 0, len(cfg.IPs))
for _, ip := range cfg.IPs {
serverConfig := constant.NewServerConfig(
ip, // Nacos服务地址
uint64(cfg.Port), // Nacos服务端口
constant.WithContextPath(cfg.Context),
)
serverConfigs = append(serverConfigs, *serverConfig)
}
nnc.sc = serverConfigs
nnc.cc = constant.NewClientConfig(
constant.WithNamespaceId(nnc.cfg.Namespace), // 命名空间ID
constant.WithTimeoutMs(5000), // 请求超时时间
constant.WithNotLoadCacheAtStart(false), // 启动时不读取缓存
constant.WithLogDir("/tmp/nacos/log"), // 日志目录
constant.WithCacheDir("/tmp/nacos/cache"), // 缓存目录
// constant.WithUsername("nacos"), // 用户名
// constant.WithPassword("nacos"), // 密码
)
namingClient, err := clients.NewNamingClient(
vo.NacosClientParam{
ClientConfig: nnc.cc,
ServerConfigs: nnc.sc,
},
)
if err != nil {
return nil, err
}
nnc.cli = namingClient
return &nnc, nil
}
func New(cfg *config.NacosSvcConfig, cc *constant.ClientConfig, sc []constant.ServerConfig) (*NacosServiceClient, error) {
nnc := NacosServiceClient{
cfg: cfg,
}
namingClient, err := clients.NewNamingClient(
vo.NacosClientParam{
ClientConfig: nnc.cc,
ServerConfigs: sc,
},
)
if err != nil {
return nil, err
}
nnc.cli = namingClient
return &nnc, nil
}
func (x *NacosServiceClient) Register() error {
_, err := x.cli.RegisterInstance(vo.RegisterInstanceParam{
Ip: x.cfg.ServiceIP,
Port: uint64(x.cfg.ServicePort),
ServiceName: x.cfg.ServiceName,
Weight: float64(x.cfg.Weight),
ClusterName: x.cfg.ClusterName,
GroupName: x.cfg.GroupName,
Enable: x.cfg.Enable,
Healthy: x.cfg.Healthy,
Ephemeral: x.cfg.Ephemeral,
})
return err
}
func (x *NacosServiceClient) Deregister() error {
_, err := x.cli.DeregisterInstance(vo.DeregisterInstanceParam{
Ip: x.cfg.ServiceIP,
Port: uint64(x.cfg.Port),
Cluster: x.cfg.ClusterName,
ServiceName: x.cfg.ServiceName,
Ephemeral: x.cfg.Ephemeral,
GroupName: x.cfg.GroupName,
})
return err
}
func (x *NacosServiceClient) SelectInstances(groupName, serviceName string, healthOnly bool) ([]model.Instance, error) {
return x.cli.SelectInstances(vo.SelectInstancesParam{
ServiceName: serviceName,
GroupName: groupName,
HealthyOnly: healthOnly,
})
}
package nacos
import (
"gitlab.wanzhuangkj.com/tush/xpkg/onacos"
"github.com/nacos-group/nacos-sdk-go/clients"
"github.com/nacos-group/nacos-sdk-go/clients/naming_client"
"github.com/nacos-group/nacos-sdk-go/common/constant"
"github.com/nacos-group/nacos-sdk-go/model"
"github.com/nacos-group/nacos-sdk-go/vo"
)
type NacosNamingClient struct {
cc *constant.ClientConfig
sc []constant.ServerConfig
cfg *onacos.NacosConfig
cli naming_client.INamingClient
}
func New(cfg *onacos.NacosConfig, cc *constant.ClientConfig, sc []constant.ServerConfig) (*NacosNamingClient, error) {
nnc := NacosNamingClient{
cc: cc,
sc: sc,
cfg: cfg,
}
namingClient, err := clients.NewNamingClient(
vo.NacosClientParam{
ClientConfig: nnc.cc,
ServerConfigs: sc,
},
)
if err != nil {
return nil, err
}
nnc.cli = namingClient
return &nnc, nil
}
func (x *NacosNamingClient) Register() error {
_, err := x.cli.RegisterInstance(vo.RegisterInstanceParam{
Ip: x.cfg.Rd.IP,
Port: uint64(x.cfg.Rd.Port),
ServiceName: x.cfg.Rd.ServiceName,
Weight: float64(x.cfg.Rd.Weight),
ClusterName: x.cfg.Rd.ClusterName,
GroupName: x.cfg.Rd.GroupName,
Enable: x.cfg.Rd.Enable,
Healthy: x.cfg.Rd.Healthy,
Ephemeral: x.cfg.Rd.Ephemeral,
})
return err
}
func (x *NacosNamingClient) Deregister() error {
_, err := x.cli.DeregisterInstance(vo.DeregisterInstanceParam{
Ip: x.cfg.Rd.IP,
Port: uint64(x.cfg.Rd.Port),
Cluster: x.cfg.Rd.ClusterName,
ServiceName: x.cfg.Rd.ServiceName,
Ephemeral: x.cfg.Rd.Ephemeral,
GroupName: x.cfg.Rd.GroupName,
})
return err
}
func (x *NacosNamingClient) SelectInstances(groupName, serviceName string, healthOnly bool) ([]model.Instance, error) {
return x.cli.SelectInstances(vo.SelectInstancesParam{
ServiceName: serviceName,
GroupName: groupName,
HealthyOnly: healthOnly,
})
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论