diff --git a/registry/handler/handler.go b/registry/handler/handler.go index 68d4523b..a592dffa 100644 --- a/registry/handler/handler.go +++ b/registry/handler/handler.go @@ -28,8 +28,10 @@ func (r *Registry) GetService(ctx context.Context, req *pb.GetRequest, rsp *pb.G func (r *Registry) Register(ctx context.Context, req *pb.Service, rsp *pb.EmptyResponse) error { var regOpts []registry.RegisterOption - ttl := time.Duration(req.Options.Ttl) * time.Second - regOpts = append(regOpts, registry.RegisterTTL(ttl)) + if req.Options != nil { + ttl := time.Duration(req.Options.Ttl) * time.Second + regOpts = append(regOpts, registry.RegisterTTL(ttl)) + } err := r.Registry.Register(service.ToService(req), regOpts...) if err != nil { diff --git a/registry/proto/registry.proto b/registry/proto/registry.proto index c161828b..ddc09669 100644 --- a/registry/proto/registry.proto +++ b/registry/proto/registry.proto @@ -12,11 +12,11 @@ service Registry { // Service represents a go-micro service message Service { - string name = 1; - string version = 2; - map metadata = 3; - repeated Endpoint endpoints = 4; - repeated Node nodes = 5; + string name = 1; + string version = 2; + map metadata = 3; + repeated Endpoint endpoints = 4; + repeated Node nodes = 5; Options options = 6; }