fix: changge the string ping format

pull/1987/head
luhaoling 2 years ago
parent 261ea4706f
commit 39d5d3d89b

@ -104,12 +104,11 @@ func buildMongoURI(config *config.GlobalConfig) string {
maxPoolSize = fmt.Sprint(config.Mongo.MaxPoolSize) maxPoolSize = fmt.Sprint(config.Mongo.MaxPoolSize)
} }
uriFormat := "mongodb://%s/%s?maxPoolSize=%s" uriFormat := fmt.Sprintf("mongodb://%s/%s?maxPoolSize=%s", address, database, maxPoolSize)
if username != "" && password != "" { if username != "" && password != "" {
uriFormat = "mongodb://%s:%s@%s/%s?maxPoolSize=%s" return fmt.Sprintf("mongodb://%s:%s@%s/%s?maxPoolSize=%s", username, password, address, database, maxPoolSize)
return fmt.Sprintf(uriFormat, username, password, address, database, maxPoolSize)
} }
return fmt.Sprintf(uriFormat, address, database, maxPoolSize) return uriFormat
} }
func shouldRetry(err error) bool { func shouldRetry(err error) bool {

Loading…
Cancel
Save