Support connect native registration

This commit is contained in:
Asim Aslam
2018-08-06 17:12:34 +01:00
parent 88505388c1
commit af328ee7b4
2 changed files with 39 additions and 3 deletions

View File

@@ -8,6 +8,16 @@ import (
"github.com/micro/go-micro/registry"
)
// Connect specifies services should be registered as Consul Connect services
func Connect() registry.Option {
return func(o *registry.Options) {
if o.Context == nil {
o.Context = context.Background()
}
o.Context = context.WithValue(o.Context, "consul_connect", true)
}
}
func Config(c *consul.Config) registry.Option {
return func(o *registry.Options) {
if o.Context == nil {