mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-25 02:58:26 +08:00
fix: mongo
This commit is contained in:
parent
86aebfc0bd
commit
f0075265d5
@ -103,9 +103,9 @@ func buildMongoURI() string {
|
|||||||
maxPoolSize = fmt.Sprint(config.Config.Mongo.MaxPoolSize)
|
maxPoolSize = fmt.Sprint(config.Config.Mongo.MaxPoolSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
uriFormat := "mongodb://%s/%s?maxPoolSize=%s&authSource=admin"
|
uriFormat := "mongodb://%s/%s?maxPoolSize=%s"
|
||||||
if username != "" && password != "" {
|
if username != "" && password != "" {
|
||||||
uriFormat = "mongodb://%s:%s@%s/%s?maxPoolSize=%s&authSource=admin"
|
uriFormat = "mongodb://%s:%s@%s/%s?maxPoolSize=%s"
|
||||||
return fmt.Sprintf(uriFormat, username, password, address, database, maxPoolSize)
|
return fmt.Sprintf(uriFormat, username, password, address, database, maxPoolSize)
|
||||||
}
|
}
|
||||||
return fmt.Sprintf(uriFormat, address, database, maxPoolSize)
|
return fmt.Sprintf(uriFormat, address, database, maxPoolSize)
|
||||||
|
@ -171,10 +171,10 @@ func buildMongoURI() string {
|
|||||||
mongodbHosts := strings.Join(config.Config.Mongo.Address, ",")
|
mongodbHosts := strings.Join(config.Config.Mongo.Address, ",")
|
||||||
|
|
||||||
if username != "" && password != "" {
|
if username != "" && password != "" {
|
||||||
return fmt.Sprintf("mongodb://%s:%s@%s/%s?maxPoolSize=%d&authSource=admin",
|
return fmt.Sprintf("mongodb://%s:%s@%s/%s?maxPoolSize=%d",
|
||||||
username, password, mongodbHosts, database, maxPoolSize)
|
username, password, mongodbHosts, database, maxPoolSize)
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("mongodb://%s/%s?maxPoolSize=%d&authSource=admin",
|
return fmt.Sprintf("mongodb://%s/%s?maxPoolSize=%d",
|
||||||
mongodbHosts, database, maxPoolSize)
|
mongodbHosts, database, maxPoolSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user