Merge branch 'errcode' of github.com:OpenIMSDK/Open-IM-Server into errcode

# Conflicts:
#	cmd/cmdutils/main.go
This commit is contained in:
wangchuxiao
2023-03-07 18:01:36 +08:00
53 changed files with 428 additions and 636 deletions
+9 -3
View File
@@ -5,10 +5,11 @@ import (
"OpenIM/pkg/common/cmd"
"OpenIM/pkg/common/config"
"OpenIM/pkg/common/log"
"OpenIM/pkg/common/mw"
"fmt"
"github.com/OpenIMSDK/openKeeper"
"github.com/spf13/cobra"
"os"
"strconv"
"OpenIM/pkg/common/constant"
@@ -40,14 +41,19 @@ func run(port int) error {
if port == 0 {
port = config.Config.Api.GinPort[0]
}
zk, err := openKeeper.NewClient(nil, "", 10, "", "")
if err != nil {
return err
}
log.NewPrivateLog(constant.LogFileName)
router := api.NewGinRouter()
zk.AddOption(mw.GrpcClient())
router := api.NewGinRouter(zk)
address := constant.LocalHost + ":" + strconv.Itoa(port)
if config.Config.Api.ListenIP != "" {
address = config.Config.Api.ListenIP + ":" + strconv.Itoa(port)
}
fmt.Println("start api server, address: ", address, ", OpenIM version: ", constant.CurrentVersion)
err := router.Run(address)
err = router.Run(address)
if err != nil {
log.Error("", "api run failed ", address, err.Error())
return err