Skip to content

Commit

Permalink
fix: bug
Browse files Browse the repository at this point in the history
  • Loading branch information
withchao committed Apr 23, 2024
1 parent 32640e1 commit 35c68a9
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ require (
github.com/mitchellh/mapstructure v1.5.0
github.com/openimsdk/gomake v0.0.6
github.com/openimsdk/protocol v0.0.63
github.com/openimsdk/tools v0.0.48
github.com/openimsdk/tools v0.0.49-alpha.1
github.com/redis/go-redis/v9 v9.5.1
github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.18.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ github.com/openimsdk/gomake v0.0.6 h1:bJmQWDHBj8PQ7oGJ2SL3Gsx0k5CdI/BPfGzlGcV105
github.com/openimsdk/gomake v0.0.6/go.mod h1:PndCozNc2IsQIciyn9mvEblYWZwJmAI+06z94EY+csI=
github.com/openimsdk/protocol v0.0.63 h1:9DnweZe9nEYDFa4fGTbC9Cqi0gLUdtBhRo1NRP2X3WQ=
github.com/openimsdk/protocol v0.0.63/go.mod h1:OZQA9FR55lseYoN2Ql1XAHYKHJGu7OMNkUbuekrKCM8=
github.com/openimsdk/tools v0.0.48 h1:GgRtYtMNlJ0PzCR9XQzMVDv7O+Sp8Hg9Grrlnh8HFGE=
github.com/openimsdk/tools v0.0.48/go.mod h1:P4oGP1Pd+d4ctbLD5U/XQTgl8yu8Hd3skx640Fr69ko=
github.com/openimsdk/tools v0.0.49-alpha.1 h1:LtlKh5t/1b1tNikR9LWwV9PIJclUNsVqpEzEke4CMtk=
github.com/openimsdk/tools v0.0.49-alpha.1/go.mod h1:P4oGP1Pd+d4ctbLD5U/XQTgl8yu8Hd3skx640Fr69ko=
github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
github.com/pion/datachannel v1.5.5 h1:10ef4kwdjije+M9d7Xm9im2Y3O6A6ccQb0zcqZcJew8=
Expand Down
4 changes: 2 additions & 2 deletions internal/api/admin/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ func Start(ctx context.Context, index int, config *Config) error {
adminApi := New(chatClient, adminClient, im, &base)
mwApi := chatmw.New(adminClient)
gin.SetMode(gin.ReleaseMode)
engine := gin.Default()
engine.Use(mw.CorsHandler(), mw.GinParseOperationID())
engine := gin.New()
engine.Use(gin.Recovery(), mw.CorsHandler(), mw.GinParseOperationID())
SetAdminRoute(engine, adminApi, mwApi)
return engine.Run(fmt.Sprintf(":%d", apiPort))
}
Expand Down
4 changes: 2 additions & 2 deletions internal/api/chat/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ func Start(ctx context.Context, index int, config *Config) error {
adminApi := New(chatClient, adminClient, im, &base)
mwApi := chatmw.New(adminClient)
gin.SetMode(gin.ReleaseMode)
engine := gin.Default()
engine.Use(mw.CorsHandler(), mw.GinParseOperationID())
engine := gin.New()
engine.Use(gin.Recovery(), mw.CorsHandler(), mw.GinParseOperationID())
SetChatRoute(engine, adminApi, mwApi)
return engine.Run(fmt.Sprintf(":%d", apiPort))
}
Expand Down
3 changes: 2 additions & 1 deletion internal/rpc/admin/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/openimsdk/tools/db/redisutil"
"github.com/openimsdk/tools/discovery"
"github.com/openimsdk/tools/errs"
"github.com/openimsdk/tools/mw"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"math/rand"
Expand Down Expand Up @@ -49,7 +50,7 @@ func Start(ctx context.Context, config *Config, client discovery.SvcDiscoveryReg
if err != nil {
return err
}
conn, err := client.GetConn(ctx, config.Share.RpcRegisterName.Chat, grpc.WithTransportCredentials(insecure.NewCredentials()))
conn, err := client.GetConn(ctx, config.Share.RpcRegisterName.Chat, grpc.WithTransportCredentials(insecure.NewCredentials()), mw.GrpcClient())
if err != nil {
return err
}
Expand Down
3 changes: 2 additions & 1 deletion internal/rpc/chat/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/openimsdk/tools/db/mongoutil"
"github.com/openimsdk/tools/discovery"
"github.com/openimsdk/tools/errs"
"github.com/openimsdk/tools/mw"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"time"
Expand Down Expand Up @@ -52,7 +53,7 @@ func Start(ctx context.Context, config *Config, client discovery.SvcDiscoveryReg
if err != nil {
return err
}
conn, err := client.GetConn(ctx, config.Share.RpcRegisterName.Admin, grpc.WithTransportCredentials(insecure.NewCredentials()))
conn, err := client.GetConn(ctx, config.Share.RpcRegisterName.Admin, grpc.WithTransportCredentials(insecure.NewCredentials()), mw.GrpcClient())
if err != nil {
return err
}
Expand Down

0 comments on commit 35c68a9

Please sign in to comment.