add a noop registry

This commit is contained in:
Asim Aslam
2020-08-09 16:17:52 +01:00
parent 51f8b4ae3d
commit e8ea0f85e9
3 changed files with 61 additions and 0 deletions

View File

@@ -595,6 +595,11 @@ func (g *grpcServer) Register() error {
config := g.opts
g.RUnlock()
// only register if it exists or is not noop
if config.Registry == nil || config.Registry.String() == "noop" {
return nil
}
regFunc := func(service *registry.Service) error {
var regErr error
@@ -779,6 +784,11 @@ func (g *grpcServer) Deregister() error {
config := g.opts
g.RUnlock()
// only register if it exists or is not noop
if config.Registry == nil || config.Registry.String() == "noop" {
return nil
}
// check the advertise address first
// if it exists then use it, otherwise
// use the address