add a noop registry
This commit is contained in:
parent
c258ff3ca4
commit
393577e5e6
10
grpc.go
10
grpc.go
@ -595,6 +595,11 @@ func (g *grpcServer) Register() error {
|
|||||||
config := g.opts
|
config := g.opts
|
||||||
g.RUnlock()
|
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 {
|
regFunc := func(service *registry.Service) error {
|
||||||
var regErr error
|
var regErr error
|
||||||
|
|
||||||
@ -779,6 +784,11 @@ func (g *grpcServer) Deregister() error {
|
|||||||
config := g.opts
|
config := g.opts
|
||||||
g.RUnlock()
|
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
|
// check the advertise address first
|
||||||
// if it exists then use it, otherwise
|
// if it exists then use it, otherwise
|
||||||
// use the address
|
// use the address
|
||||||
|
Loading…
Reference in New Issue
Block a user