feat: registry.
This commit is contained in:
@@ -2,12 +2,23 @@ package servicecomb
|
||||
|
||||
import (
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
"github.com/go-kratos/kratos/v2/registry"
|
||||
|
||||
servicecombClient "github.com/go-chassis/sc-client"
|
||||
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
r "github.com/tx7do/kratos-bootstrap/registry"
|
||||
)
|
||||
|
||||
func init() {
|
||||
r.RegisterRegistrarCreator(string(r.Servicecomb), func(c *conf.Registry) registry.Registrar {
|
||||
return NewRegistry(c)
|
||||
})
|
||||
r.RegisterDiscoveryCreator(string(r.Servicecomb), func(c *conf.Registry) registry.Discovery {
|
||||
return NewRegistry(c)
|
||||
})
|
||||
}
|
||||
|
||||
// NewRegistry 创建一个注册发现客户端 - Servicecomb
|
||||
func NewRegistry(c *conf.Registry) *Registry {
|
||||
if c == nil || c.Servicecomb == nil {
|
||||
|
||||
@@ -8,7 +8,7 @@ replace (
|
||||
github.com/armon/go-metrics => github.com/hashicorp/go-metrics v0.4.1
|
||||
|
||||
github.com/tx7do/kratos-bootstrap/api => ../../api
|
||||
github.com/tx7do/kratos-bootstrap/registry => ../registry
|
||||
github.com/tx7do/kratos-bootstrap/registry => ../
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -17,7 +17,8 @@ require (
|
||||
github.com/go-kratos/kratos/v2 v2.8.4
|
||||
github.com/gofrs/uuid v4.4.0+incompatible
|
||||
github.com/stretchr/testify v1.10.0
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.20
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.21
|
||||
github.com/tx7do/kratos-bootstrap/registry v0.1.0
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
Reference in New Issue
Block a user