Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
40ec693f17 | ||
|
|
968f1b72b0 | ||
|
|
43da1db483 |
4
cache/redis/go.mod
vendored
4
cache/redis/go.mod
vendored
@@ -4,11 +4,13 @@ go 1.22.0
|
||||
|
||||
toolchain go1.22.1
|
||||
|
||||
replace github.com/tx7do/kratos-bootstrap/api => ../../api
|
||||
|
||||
require (
|
||||
github.com/go-kratos/kratos/v2 v2.8.2
|
||||
github.com/redis/go-redis/extra/redisotel/v9 v9.7.0
|
||||
github.com/redis/go-redis/v9 v9.7.0
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.5
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
2
cache/redis/go.sum
vendored
2
cache/redis/go.sum
vendored
@@ -27,8 +27,6 @@ github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa
|
||||
github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.4 h1:X34nZ8c7oHDlfJRJfmyha6l6pkg8f71HM+4BOZlB7JE=
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.4/go.mod h1:Ag3hjntWUFCJP9yQMSMqf5ezCS/pdKrLeYfrsmMkRjw=
|
||||
go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U=
|
||||
go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg=
|
||||
go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M=
|
||||
|
||||
@@ -9,7 +9,7 @@ replace github.com/tx7do/kratos-bootstrap/api => ../../api
|
||||
require (
|
||||
github.com/go-kratos/kratos/contrib/config/apollo/v2 v2.0.0-20241105072421-f8b97f675b32
|
||||
github.com/go-kratos/kratos/v2 v2.8.2
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.5
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
@@ -14,7 +14,7 @@ replace (
|
||||
require (
|
||||
github.com/go-kratos/kratos/v2 v2.8.2
|
||||
github.com/hashicorp/consul/api v1.30.0
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.5
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
@@ -9,7 +9,7 @@ replace github.com/tx7do/kratos-bootstrap/api => ../../api
|
||||
require (
|
||||
github.com/go-kratos/kratos/contrib/config/etcd/v2 v2.0.0-20241105072421-f8b97f675b32
|
||||
github.com/go-kratos/kratos/v2 v2.8.2
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.5
|
||||
go.etcd.io/etcd/client/v3 v3.5.17
|
||||
google.golang.org/grpc v1.68.0
|
||||
)
|
||||
|
||||
@@ -14,7 +14,7 @@ replace (
|
||||
require (
|
||||
github.com/go-kratos/kratos/contrib/config/kubernetes/v2 v2.0.0-20241105072421-f8b97f675b32
|
||||
github.com/go-kratos/kratos/v2 v2.8.2
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.5
|
||||
k8s.io/client-go v0.31.2
|
||||
)
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ require (
|
||||
github.com/go-kratos/kratos/contrib/config/nacos/v2 v2.0.0-20241105072421-f8b97f675b32
|
||||
github.com/go-kratos/kratos/v2 v2.8.2
|
||||
github.com/nacos-group/nacos-sdk-go v1.1.5
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.5
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
@@ -8,7 +8,7 @@ replace github.com/tx7do/kratos-bootstrap/api => ../../api
|
||||
|
||||
require (
|
||||
github.com/go-kratos/kratos/v2 v2.8.2
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.5
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
34
go.mod
34
go.mod
@@ -44,24 +44,24 @@ require (
|
||||
github.com/gorilla/handlers v1.5.2
|
||||
github.com/olekukonko/tablewriter v0.0.5
|
||||
github.com/spf13/cobra v1.8.1
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/config/apollo v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/config/consul v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/config/etcd v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/config/kubernetes v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/config/nacos v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.5
|
||||
github.com/tx7do/kratos-bootstrap/config/apollo v0.0.5
|
||||
github.com/tx7do/kratos-bootstrap/config/consul v0.0.5
|
||||
github.com/tx7do/kratos-bootstrap/config/etcd v0.0.5
|
||||
github.com/tx7do/kratos-bootstrap/config/kubernetes v0.0.5
|
||||
github.com/tx7do/kratos-bootstrap/config/nacos v0.0.5
|
||||
github.com/tx7do/kratos-bootstrap/config/polaris v0.0.1
|
||||
github.com/tx7do/kratos-bootstrap/logger/fluent v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/logger/logrus v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/logger/tencent v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/logger/zap v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/registry/consul v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/registry/etcd v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/registry/eureka v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/registry/kubernetes v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/registry/nacos v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/registry/servicecomb v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/registry/zookeeper v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/logger/fluent v0.0.5
|
||||
github.com/tx7do/kratos-bootstrap/logger/logrus v0.0.5
|
||||
github.com/tx7do/kratos-bootstrap/logger/tencent v0.0.5
|
||||
github.com/tx7do/kratos-bootstrap/logger/zap v0.0.5
|
||||
github.com/tx7do/kratos-bootstrap/registry/consul v0.0.5
|
||||
github.com/tx7do/kratos-bootstrap/registry/etcd v0.0.5
|
||||
github.com/tx7do/kratos-bootstrap/registry/eureka v0.0.5
|
||||
github.com/tx7do/kratos-bootstrap/registry/kubernetes v0.0.5
|
||||
github.com/tx7do/kratos-bootstrap/registry/nacos v0.0.5
|
||||
github.com/tx7do/kratos-bootstrap/registry/servicecomb v0.0.5
|
||||
github.com/tx7do/kratos-bootstrap/registry/zookeeper v0.0.5
|
||||
go.opentelemetry.io/otel v1.32.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.32.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.32.0
|
||||
|
||||
@@ -9,7 +9,7 @@ replace github.com/tx7do/kratos-bootstrap/api => ../../api
|
||||
require (
|
||||
github.com/go-kratos/kratos/contrib/log/aliyun/v2 v2.0.0-20241105072421-f8b97f675b32
|
||||
github.com/go-kratos/kratos/v2 v2.8.2
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.5
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
@@ -9,7 +9,7 @@ replace github.com/tx7do/kratos-bootstrap/api => ../../api
|
||||
require (
|
||||
github.com/go-kratos/kratos/contrib/log/fluent/v2 v2.0.0-20241105072421-f8b97f675b32
|
||||
github.com/go-kratos/kratos/v2 v2.8.2
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.5
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
@@ -10,7 +10,7 @@ require (
|
||||
github.com/go-kratos/kratos/contrib/log/logrus/v2 v2.0.0-20241105072421-f8b97f675b32
|
||||
github.com/go-kratos/kratos/v2 v2.8.2
|
||||
github.com/sirupsen/logrus v1.9.3
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.5
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
@@ -9,7 +9,7 @@ replace github.com/tx7do/kratos-bootstrap/api => ../../api
|
||||
require (
|
||||
github.com/go-kratos/kratos/contrib/log/tencent/v2 v2.0.0-20241105072421-f8b97f675b32
|
||||
github.com/go-kratos/kratos/v2 v2.8.2
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.5
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
@@ -9,7 +9,7 @@ replace github.com/tx7do/kratos-bootstrap/api => ../../api
|
||||
require (
|
||||
github.com/go-kratos/kratos/contrib/log/zap/v2 v2.0.0-20241105072421-f8b97f675b32
|
||||
github.com/go-kratos/kratos/v2 v2.8.2
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.5
|
||||
go.uber.org/zap v1.27.0
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1
|
||||
)
|
||||
|
||||
@@ -4,10 +4,12 @@ go 1.22.0
|
||||
|
||||
toolchain go1.22.1
|
||||
|
||||
replace github.com/tx7do/kratos-bootstrap/api => ../../api
|
||||
|
||||
require (
|
||||
github.com/go-kratos/kratos/v2 v2.8.2
|
||||
github.com/minio/minio-go/v7 v7.0.80
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.5
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
@@ -27,8 +27,6 @@ github.com/rs/xid v1.6.0 h1:fV591PaemRlL6JfRxGDEPl69wICngIQ3shQtzfy2gxU=
|
||||
github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.4 h1:X34nZ8c7oHDlfJRJfmyha6l6pkg8f71HM+4BOZlB7JE=
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.4/go.mod h1:Ag3hjntWUFCJP9yQMSMqf5ezCS/pdKrLeYfrsmMkRjw=
|
||||
golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=
|
||||
golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg=
|
||||
golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo=
|
||||
|
||||
@@ -16,7 +16,7 @@ require (
|
||||
github.com/go-kratos/kratos/v2 v2.8.2
|
||||
github.com/hashicorp/consul/api v1.30.0
|
||||
github.com/stretchr/testify v1.9.0
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.5
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
@@ -10,7 +10,7 @@ require (
|
||||
github.com/go-kratos/kratos/contrib/registry/etcd/v2 v2.0.0-20241105072421-f8b97f675b32
|
||||
github.com/go-kratos/kratos/v2 v2.8.2
|
||||
github.com/stretchr/testify v1.9.0
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.5
|
||||
go.etcd.io/etcd/client/v3 v3.5.17
|
||||
)
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ require (
|
||||
github.com/go-kratos/kratos/contrib/registry/eureka/v2 v2.0.0-20241105072421-f8b97f675b32
|
||||
github.com/go-kratos/kratos/v2 v2.8.2
|
||||
github.com/stretchr/testify v1.9.0
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.5
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
@@ -15,7 +15,7 @@ require (
|
||||
github.com/go-kratos/kratos/contrib/registry/kubernetes/v2 v2.0.0-20241105072421-f8b97f675b32
|
||||
github.com/go-kratos/kratos/v2 v2.8.2
|
||||
github.com/stretchr/testify v1.9.0
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.5
|
||||
k8s.io/client-go v0.31.2
|
||||
)
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ require (
|
||||
github.com/go-kratos/kratos/v2 v2.8.2
|
||||
github.com/nacos-group/nacos-sdk-go v1.1.5
|
||||
github.com/stretchr/testify v1.9.0
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.5
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
@@ -11,7 +11,7 @@ require (
|
||||
github.com/go-kratos/kratos/v2 v2.8.2
|
||||
github.com/polarismesh/polaris-go v1.5.8
|
||||
github.com/stretchr/testify v1.9.0
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.5
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
@@ -11,7 +11,7 @@ require (
|
||||
github.com/go-kratos/kratos/contrib/registry/servicecomb/v2 v2.0.0-20241105072421-f8b97f675b32
|
||||
github.com/go-kratos/kratos/v2 v2.8.2
|
||||
github.com/stretchr/testify v1.9.0
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.5
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
@@ -11,7 +11,7 @@ require (
|
||||
github.com/go-kratos/kratos/v2 v2.8.2
|
||||
github.com/go-zookeeper/zk v1.0.4
|
||||
github.com/stretchr/testify v1.9.0
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.4
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.5
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
32
rpc/grpc.go
32
rpc/grpc.go
@@ -29,14 +29,10 @@ import (
|
||||
const defaultTimeout = 5 * time.Second
|
||||
|
||||
// CreateGrpcClient 创建GRPC客户端
|
||||
func CreateGrpcClient(ctx context.Context, r registry.Discovery, serviceName string, cfg *conf.Bootstrap, opts ...kratosGrpc.ClientOption) grpc.ClientConnInterface {
|
||||
func CreateGrpcClient(ctx context.Context, r registry.Discovery, serviceName string, cfg *conf.Bootstrap, mds ...middleware.Middleware) grpc.ClientConnInterface {
|
||||
|
||||
var options []kratosGrpc.ClientOption
|
||||
|
||||
if opts != nil {
|
||||
options = append(options, opts...)
|
||||
}
|
||||
|
||||
options = append(options, kratosGrpc.WithDiscovery(r))
|
||||
|
||||
var endpoint string
|
||||
@@ -47,7 +43,7 @@ func CreateGrpcClient(ctx context.Context, r registry.Discovery, serviceName str
|
||||
}
|
||||
options = append(options, kratosGrpc.WithEndpoint(endpoint))
|
||||
|
||||
options = append(options, initGrpcClientConfig(cfg)...)
|
||||
options = append(options, initGrpcClientConfig(cfg, mds...)...)
|
||||
|
||||
conn, err := kratosGrpc.DialInsecure(ctx, options...)
|
||||
if err != nil {
|
||||
@@ -57,7 +53,7 @@ func CreateGrpcClient(ctx context.Context, r registry.Discovery, serviceName str
|
||||
return conn
|
||||
}
|
||||
|
||||
func initGrpcClientConfig(cfg *conf.Bootstrap) []kratosGrpc.ClientOption {
|
||||
func initGrpcClientConfig(cfg *conf.Bootstrap, mds ...middleware.Middleware) []kratosGrpc.ClientOption {
|
||||
if cfg.Client == nil || cfg.Client.Grpc == nil {
|
||||
return nil
|
||||
}
|
||||
@@ -70,9 +66,9 @@ func initGrpcClientConfig(cfg *conf.Bootstrap) []kratosGrpc.ClientOption {
|
||||
}
|
||||
options = append(options, kratosGrpc.WithTimeout(timeout))
|
||||
|
||||
var ms []middleware.Middleware
|
||||
ms = append(ms, mds...)
|
||||
if cfg.Client.Grpc.Middleware != nil {
|
||||
var ms []middleware.Middleware
|
||||
|
||||
if cfg.Client.Grpc.Middleware.GetEnableRecovery() {
|
||||
ms = append(ms, recovery.Recovery())
|
||||
}
|
||||
@@ -83,6 +79,7 @@ func initGrpcClientConfig(cfg *conf.Bootstrap) []kratosGrpc.ClientOption {
|
||||
ms = append(ms, validate.Validator())
|
||||
}
|
||||
}
|
||||
options = append(options, kratosGrpc.WithMiddleware(ms...))
|
||||
|
||||
if cfg.Client.Grpc.Tls != nil {
|
||||
var tlsCfg *tls.Config
|
||||
@@ -116,30 +113,26 @@ func initGrpcClientConfig(cfg *conf.Bootstrap) []kratosGrpc.ClientOption {
|
||||
}
|
||||
|
||||
// CreateGrpcServer 创建GRPC服务端
|
||||
func CreateGrpcServer(cfg *conf.Bootstrap, opts ...kratosGrpc.ServerOption) *kratosGrpc.Server {
|
||||
func CreateGrpcServer(cfg *conf.Bootstrap, mds ...middleware.Middleware) *kratosGrpc.Server {
|
||||
var options []kratosGrpc.ServerOption
|
||||
|
||||
if opts != nil {
|
||||
options = append(options, opts...)
|
||||
}
|
||||
|
||||
options = append(options, initGrpcServerConfig(cfg)...)
|
||||
options = append(options, initGrpcServerConfig(cfg, mds...)...)
|
||||
|
||||
srv := kratosGrpc.NewServer(options...)
|
||||
|
||||
return srv
|
||||
}
|
||||
|
||||
func initGrpcServerConfig(cfg *conf.Bootstrap) []kratosGrpc.ServerOption {
|
||||
func initGrpcServerConfig(cfg *conf.Bootstrap, mds ...middleware.Middleware) []kratosGrpc.ServerOption {
|
||||
if cfg.Server == nil || cfg.Server.Grpc == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var options []kratosGrpc.ServerOption
|
||||
|
||||
var ms []middleware.Middleware
|
||||
ms = append(ms, mds...)
|
||||
if cfg.Server.Grpc.Middleware != nil {
|
||||
var ms []middleware.Middleware
|
||||
|
||||
if cfg.Server.Grpc.Middleware.GetEnableRecovery() {
|
||||
ms = append(ms, recovery.Recovery())
|
||||
}
|
||||
@@ -159,9 +152,8 @@ func initGrpcServerConfig(cfg *conf.Bootstrap) []kratosGrpc.ServerOption {
|
||||
}
|
||||
ms = append(ms, midRateLimit.Server(midRateLimit.WithLimiter(limiter)))
|
||||
}
|
||||
|
||||
options = append(options, kratosGrpc.Middleware(ms...))
|
||||
}
|
||||
options = append(options, kratosGrpc.Middleware(ms...))
|
||||
|
||||
if cfg.Server.Grpc.Tls != nil {
|
||||
var tlsCfg *tls.Config
|
||||
|
||||
17
rpc/rest.go
17
rpc/rest.go
@@ -22,14 +22,10 @@ import (
|
||||
)
|
||||
|
||||
// CreateRestServer 创建REST服务端
|
||||
func CreateRestServer(cfg *conf.Bootstrap, opts ...kratosRest.ServerOption) *kratosRest.Server {
|
||||
func CreateRestServer(cfg *conf.Bootstrap, mds ...middleware.Middleware) *kratosRest.Server {
|
||||
var options []kratosRest.ServerOption
|
||||
|
||||
if opts != nil {
|
||||
options = append(options, opts...)
|
||||
}
|
||||
|
||||
options = append(options, initRestConfig(cfg)...)
|
||||
options = append(options, initRestConfig(cfg, mds...)...)
|
||||
|
||||
srv := kratosRest.NewServer(options...)
|
||||
|
||||
@@ -40,7 +36,7 @@ func CreateRestServer(cfg *conf.Bootstrap, opts ...kratosRest.ServerOption) *kra
|
||||
return srv
|
||||
}
|
||||
|
||||
func initRestConfig(cfg *conf.Bootstrap) []kratosRest.ServerOption {
|
||||
func initRestConfig(cfg *conf.Bootstrap, mds ...middleware.Middleware) []kratosRest.ServerOption {
|
||||
if cfg.Server == nil || cfg.Server.Rest == nil {
|
||||
return nil
|
||||
}
|
||||
@@ -55,9 +51,9 @@ func initRestConfig(cfg *conf.Bootstrap) []kratosRest.ServerOption {
|
||||
)))
|
||||
}
|
||||
|
||||
var ms []middleware.Middleware
|
||||
ms = append(ms, mds...)
|
||||
if cfg.Server.Rest.Middleware != nil {
|
||||
var ms []middleware.Middleware
|
||||
|
||||
if cfg.Server.Rest.Middleware.GetEnableRecovery() {
|
||||
ms = append(ms, recovery.Recovery())
|
||||
}
|
||||
@@ -77,9 +73,8 @@ func initRestConfig(cfg *conf.Bootstrap) []kratosRest.ServerOption {
|
||||
}
|
||||
ms = append(ms, midRateLimit.Server(midRateLimit.WithLimiter(limiter)))
|
||||
}
|
||||
|
||||
options = append(options, kratosRest.Middleware(ms...))
|
||||
}
|
||||
options = append(options, kratosRest.Middleware(ms...))
|
||||
|
||||
if cfg.Server.Rest.Network != "" {
|
||||
options = append(options, kratosRest.Network(cfg.Server.Rest.Network))
|
||||
|
||||
4
tag.bat
4
tag.bat
@@ -1,5 +1,3 @@
|
||||
git tag v0.3.10
|
||||
|
||||
git tag api/v0.0.5 --force
|
||||
|
||||
git tag cache/redis/v0.0.5 --force
|
||||
@@ -28,4 +26,6 @@ git tag registry/polaris/v0.0.5 --force
|
||||
git tag registry/servicecomb/v0.0.5 --force
|
||||
git tag registry/zookeeper/v0.0.5 --force
|
||||
|
||||
git tag v0.3.14
|
||||
|
||||
git push origin --tags
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
go get all
|
||||
go mod tidy
|
||||
|
||||
cd api
|
||||
go get all
|
||||
go mod tidy
|
||||
@@ -88,3 +85,7 @@ go mod tidy
|
||||
cd ../zookeeper
|
||||
go get all
|
||||
go mod tidy
|
||||
|
||||
cd ../../
|
||||
go get all
|
||||
go mod tidy
|
||||
|
||||
Reference in New Issue
Block a user