2019-06-03 20:44:43 +03:00
|
|
|
package grpc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"crypto/tls"
|
|
|
|
|
2019-06-05 12:22:28 +03:00
|
|
|
gc "github.com/micro/go-micro/client/grpc"
|
|
|
|
gs "github.com/micro/go-micro/server/grpc"
|
2019-12-30 00:07:55 +03:00
|
|
|
"github.com/micro/go-micro/service"
|
2019-06-03 20:44:43 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
// WithTLS sets the TLS config for the service
|
2019-12-30 00:07:55 +03:00
|
|
|
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),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|