feat: add middlewares config for zrpc (#2766)
* feat: add middlewares config for zrpc * chore: add tests * chore: improve codecov * chore: improve codecov
This commit is contained in:
@@ -4,10 +4,16 @@ import (
|
||||
"github.com/zeromicro/go-zero/core/discov"
|
||||
"github.com/zeromicro/go-zero/core/service"
|
||||
"github.com/zeromicro/go-zero/core/stores/redis"
|
||||
"github.com/zeromicro/go-zero/zrpc/internal"
|
||||
"github.com/zeromicro/go-zero/zrpc/resolver"
|
||||
)
|
||||
|
||||
type (
|
||||
// ClientMiddlewaresConf defines whether to use client middlewares.
|
||||
ClientMiddlewaresConf = internal.ClientMiddlewaresConf
|
||||
// ServerMiddlewaresConf defines whether to use server middlewares.
|
||||
ServerMiddlewaresConf = internal.ServerMiddlewaresConf
|
||||
|
||||
// A RpcServerConf is a rpc server config.
|
||||
RpcServerConf struct {
|
||||
service.ServiceConf
|
||||
@@ -20,18 +26,20 @@ type (
|
||||
Timeout int64 `json:",default=2000"`
|
||||
CpuThreshold int64 `json:",default=900,range=[0:1000]"`
|
||||
// grpc health check switch
|
||||
Health bool `json:",default=true"`
|
||||
Health bool `json:",default=true"`
|
||||
Middlewares ServerMiddlewaresConf
|
||||
}
|
||||
|
||||
// A RpcClientConf is a rpc client config.
|
||||
RpcClientConf struct {
|
||||
Etcd discov.EtcdConf `json:",optional,inherit"`
|
||||
Endpoints []string `json:",optional"`
|
||||
Target string `json:",optional"`
|
||||
App string `json:",optional"`
|
||||
Token string `json:",optional"`
|
||||
NonBlock bool `json:",optional"`
|
||||
Timeout int64 `json:",default=2000"`
|
||||
Etcd discov.EtcdConf `json:",optional,inherit"`
|
||||
Endpoints []string `json:",optional"`
|
||||
Target string `json:",optional"`
|
||||
App string `json:",optional"`
|
||||
Token string `json:",optional"`
|
||||
NonBlock bool `json:",optional"`
|
||||
Timeout int64 `json:",default=2000"`
|
||||
Middlewares ClientMiddlewaresConf
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user