mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-11 23:47:32 +08:00
fix: mogodb url connent
This commit is contained in:
parent
c2b0b01c78
commit
5b29273425
@ -158,6 +158,8 @@ func checkMysql() error {
|
|||||||
|
|
||||||
func checkMongo() error {
|
func checkMongo() error {
|
||||||
var client *mongo.Client
|
var client *mongo.Client
|
||||||
|
uri := "mongodb://sample.host:27017/?maxPoolSize=20&w=majority"
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
if client != nil {
|
if client != nil {
|
||||||
client.Disconnect(context.TODO())
|
client.Disconnect(context.TODO())
|
||||||
@ -184,9 +186,7 @@ func checkMongo() error {
|
|||||||
config.Config.Mongo.MaxPoolSize)
|
config.Config.Mongo.MaxPoolSize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
client, err := mongo.Connect(context.TODO(), options.Client().ApplyURI(
|
client, err := mongo.Connect(context.TODO(), options.Client().ApplyURI(uri)
|
||||||
fmt.Sprintf("mongodb://%v:%v@%v/?authSource=admin",
|
|
||||||
config.Config.Mongo.Username, config.Config.Mongo.Password, mongodbHosts)))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errs.Wrap(err)
|
return errs.Wrap(err)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user