package server import ( "github.com/go-kratos/kratos/contrib/registry/consul/v2" "github.com/go-kratos/kratos/v2/log" "github.com/google/wire" "github.com/hashicorp/consul/api" "hilo/app/service/country/internal/conf" ) // ProviderSet is server providers. var ( ProviderSet = wire.NewSet(NewGRPCServer, NewConsulRegister) logHelper *log.Helper ) func NewConsulRegister(conf *conf.Consul) *consul.Registry { cfg := api.DefaultConfig() cfg.Address = conf.Addr consulClient, err := api.NewClient(cfg) if err != nil { panic(err) } registry := consul.New(consulClient, consul.WithHealthCheck(true), ) return registry }