feat: refactor go.mod.

This commit is contained in:
tx7do
2024-11-14 15:25:58 +08:00
parent 62ee65a36b
commit f3d17b9d34
9 changed files with 46 additions and 15 deletions

View File

@@ -1,9 +1,9 @@
package consul
import (
consulKratos "github.com/go-kratos/kratos/contrib/registry/consul/v2"
"github.com/go-kratos/kratos/v2/log"
consulKratos "github.com/go-kratos/kratos/contrib/registry/consul/v2"
consulClient "github.com/hashicorp/consul/api"
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
@@ -11,6 +11,10 @@ import (
// NewRegistry 创建一个注册发现客户端 - Consul
func NewRegistry(c *conf.Registry) *consulKratos.Registry {
if c == nil || c.Consul == nil {
return nil
}
cfg := consulClient.DefaultConfig()
cfg.Address = c.Consul.GetAddress()
cfg.Scheme = c.Consul.GetScheme()