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

test-errcode
wangchuxiao 2 years ago
commit 19ae659e44

@ -5,9 +5,10 @@ import (
chat "Open_IM/internal/rpc/msg" chat "Open_IM/internal/rpc/msg"
"Open_IM/pkg/common/config" "Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant" "Open_IM/pkg/common/constant"
"Open_IM/pkg/common/db/cache"
"Open_IM/pkg/common/db/controller" "Open_IM/pkg/common/db/controller"
"Open_IM/pkg/common/db/model" imdb "Open_IM/pkg/common/db/relation"
imdb "Open_IM/pkg/common/db/mysql" "Open_IM/pkg/common/db/unrelation"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/common/middleware" "Open_IM/pkg/common/middleware"
promePkg "Open_IM/pkg/common/prometheus" promePkg "Open_IM/pkg/common/prometheus"
@ -67,8 +68,7 @@ func NewGroupServer(port int) *groupServer {
} }
//redis //redis
//mongo //mongo
g.group = model.NewGroupController(groupModel) g.GroupInterface = controller.NewGroupController(groupModel.DB, cache.InitRedis(), unrelation.InitMongo())
return &g return &g
} }

@ -21,7 +21,7 @@ func NewMongoClient(mdb *mongo.Client) *Client {
return &Client{mongo: mdb} return &Client{mongo: mdb}
} }
func initMongo() *mongo.Database { func InitMongo() *mongo.Database {
uri := "mongodb://sample.host:27017/?maxPoolSize=20&w=majority" uri := "mongodb://sample.host:27017/?maxPoolSize=20&w=majority"
if config.Config.Mongo.DBUri != "" { if config.Config.Mongo.DBUri != "" {
// example: mongodb://$user:$password@mongo1.mongo:27017,mongo2.mongo:27017,mongo3.mongo:27017/$DBDatabase/?replicaSet=rs0&readPreference=secondary&authSource=admin&maxPoolSize=$DBMaxPoolSize // example: mongodb://$user:$password@mongo1.mongo:27017,mongo2.mongo:27017,mongo3.mongo:27017/$DBDatabase/?replicaSet=rs0&readPreference=secondary&authSource=admin&maxPoolSize=$DBMaxPoolSize

Loading…
Cancel
Save