feat: registry.

This commit is contained in:
Bobo
2025-06-02 14:09:11 +08:00
parent 0759f2d752
commit 54e887034f
37 changed files with 285 additions and 55 deletions

View File

@@ -2,10 +2,21 @@ package eureka
import (
"github.com/go-kratos/kratos/v2/log"
"github.com/go-kratos/kratos/v2/registry"
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
r "github.com/tx7do/kratos-bootstrap/registry"
)
func init() {
r.RegisterRegistrarCreator(string(r.Eureka), func(c *conf.Registry) registry.Registrar {
return NewRegistry(c)
})
r.RegisterDiscoveryCreator(string(r.Eureka), func(c *conf.Registry) registry.Discovery {
return NewRegistry(c)
})
}
// NewRegistry 创建一个注册发现客户端 - Eureka
func NewRegistry(c *conf.Registry) *Registry {
if c == nil || c.Eureka == nil {