mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-05 09:36:00 +08:00
Merge branch 'errcode' of github.com:OpenIMSDK/Open-IM-Server into errcode
# Conflicts: # cmd/cmdutils/main.go
This commit is contained in:
+9
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user