micro/service/grpc/options.go

22 lines
385 B
Go
Raw Normal View History

2019-06-03 20:44:43 +03:00
package grpc
import (
"crypto/tls"
gc "github.com/micro/go-micro/v3/client/grpc"
gs "github.com/micro/go-micro/v3/server/grpc"
"github.com/micro/go-micro/v3/service"
2019-06-03 20:44:43 +03:00
)
// WithTLS sets the TLS config for the service
func WithTLS(t *tls.Config) service.Option {
return func(o *service.Options) {
2019-06-03 20:44:43 +03:00
o.Client.Init(
gc.AuthTLS(t),
)
o.Server.Init(
gs.AuthTLS(t),
)
}
}