registrar.go 412 B

1234567891011121314151617
  1. package server
  2. import (
  3. "git.ikuban.com/server/kratos-nacos/registry"
  4. "github.com/go-kratos/kratos-layout/internal/conf"
  5. )
  6. func NewRegistrar(c *conf.Bootstrap) *registry.Registry {
  7. if c.Server.Registrar.Group != "" {
  8. r, err := registry.New(c.Server.Registrar.Endpoint, c.Server.Registrar.Namespace, registry.Group(c.Server.Registrar.Group))
  9. if err != nil {
  10. panic(err)
  11. }
  12. return r
  13. }
  14. return nil
  15. }