feat: registry.
This commit is contained in:
@@ -2,14 +2,25 @@ package nacos
|
||||
|
||||
import (
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
"github.com/go-kratos/kratos/v2/registry"
|
||||
|
||||
nacosClients "github.com/nacos-group/nacos-sdk-go/v2/clients"
|
||||
nacosConstant "github.com/nacos-group/nacos-sdk-go/v2/common/constant"
|
||||
nacosVo "github.com/nacos-group/nacos-sdk-go/v2/vo"
|
||||
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
r "github.com/tx7do/kratos-bootstrap/registry"
|
||||
)
|
||||
|
||||
func init() {
|
||||
r.RegisterRegistrarCreator(string(r.Nacos), func(c *conf.Registry) registry.Registrar {
|
||||
return NewRegistry(c)
|
||||
})
|
||||
r.RegisterDiscoveryCreator(string(r.Nacos), func(c *conf.Registry) registry.Discovery {
|
||||
return NewRegistry(c)
|
||||
})
|
||||
}
|
||||
|
||||
// NewRegistry 创建一个注册发现客户端 - Nacos
|
||||
func NewRegistry(c *conf.Registry) *Registry {
|
||||
if c == nil || c.Nacos == nil {
|
||||
|
||||
Reference in New Issue
Block a user