|
|
@ -5,7 +5,6 @@ import ( |
|
|
|
"github.com/go-kratos/kratos/examples/blog/internal/conf" |
|
|
|
"github.com/go-kratos/kratos/examples/blog/internal/conf" |
|
|
|
"github.com/go-kratos/kratos/examples/blog/internal/service" |
|
|
|
"github.com/go-kratos/kratos/examples/blog/internal/service" |
|
|
|
"github.com/go-kratos/kratos/v2/log" |
|
|
|
"github.com/go-kratos/kratos/v2/log" |
|
|
|
"github.com/go-kratos/kratos/v2/middleware" |
|
|
|
|
|
|
|
"github.com/go-kratos/kratos/v2/middleware/logging" |
|
|
|
"github.com/go-kratos/kratos/v2/middleware/logging" |
|
|
|
"github.com/go-kratos/kratos/v2/middleware/recovery" |
|
|
|
"github.com/go-kratos/kratos/v2/middleware/recovery" |
|
|
|
"github.com/go-kratos/kratos/v2/middleware/tracing" |
|
|
|
"github.com/go-kratos/kratos/v2/middleware/tracing" |
|
|
@ -17,12 +16,10 @@ import ( |
|
|
|
func NewGRPCServer(c *conf.Server, tracer trace.TracerProvider, blog *service.BlogService) *grpc.Server { |
|
|
|
func NewGRPCServer(c *conf.Server, tracer trace.TracerProvider, blog *service.BlogService) *grpc.Server { |
|
|
|
var opts = []grpc.ServerOption{ |
|
|
|
var opts = []grpc.ServerOption{ |
|
|
|
grpc.Middleware( |
|
|
|
grpc.Middleware( |
|
|
|
middleware.Chain( |
|
|
|
|
|
|
|
tracing.Server(tracing.WithTracerProvider(tracer)), |
|
|
|
tracing.Server(tracing.WithTracerProvider(tracer)), |
|
|
|
logging.Server(log.DefaultLogger), |
|
|
|
logging.Server(log.DefaultLogger), |
|
|
|
recovery.Recovery(), |
|
|
|
recovery.Recovery(), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if c.Grpc.Network != "" { |
|
|
|
if c.Grpc.Network != "" { |
|
|
|
opts = append(opts, grpc.Network(c.Grpc.Network)) |
|
|
|
opts = append(opts, grpc.Network(c.Grpc.Network)) |
|
|
|