mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-09 03:25:59 +08:00
MongoDB supports non-root users (#1684)
* MongoDB supports non-root users Signed-off-by: skiffer-git <44203734@qq.com> * Update component.go * Update env-template.yaml * Update docker-compose.yml * Update environment.sh * Update openim.yaml * Update mongo-init.sh --------- Signed-off-by: skiffer-git <44203734@qq.com> Co-authored-by: Xinwei Xiong <3293172751@qq.com>
This commit is contained in:
@@ -25,10 +25,6 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/minio/minio-go/v7"
|
||||
"github.com/redis/go-redis/v9"
|
||||
"gopkg.in/yaml.v3"
|
||||
|
||||
"github.com/IBM/sarama"
|
||||
"github.com/OpenIMSDK/tools/errs"
|
||||
"github.com/go-zookeeper/zk"
|
||||
@@ -38,6 +34,9 @@ import (
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
||||
|
||||
"github.com/minio/minio-go/v7/pkg/credentials"
|
||||
"github.com/minio/minio-go/v7"
|
||||
"github.com/redis/go-redis/v9"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -172,10 +171,10 @@ func buildMongoURI() string {
|
||||
mongodbHosts := strings.Join(config.Config.Mongo.Address, ",")
|
||||
|
||||
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)
|
||||
}
|
||||
return fmt.Sprintf("mongodb://%s/%s?maxPoolSize=%d&authSource=admin",
|
||||
return fmt.Sprintf("mongodb://%s/%s?maxPoolSize=%d",
|
||||
mongodbHosts, database, maxPoolSize)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user