From b17b364b02a3b43c82f7e1634779d741356b49b9 Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong (cubxxw)" <3293172751nss@gmail.com> Date: Fri, 5 Jan 2024 10:02:37 +0800 Subject: [PATCH] fix openim config mongo passwd env Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com> --- docs/contrib/environment.md | 6 ++++-- pkg/common/db/unrelation/mongo.go | 4 ++-- scripts/install/dependency.sh | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/contrib/environment.md b/docs/contrib/environment.md index e52d57235..8db462688 100644 --- a/docs/contrib/environment.md +++ b/docs/contrib/environment.md @@ -304,8 +304,10 @@ This section involves setting up MongoDB, including its port, address, and crede | -------------- | -------------- | ----------------------- | | MONGO_PORT | "27017" | Port used by MongoDB. | | MONGO_ADDRESS | [Generated IP] | IP address for MongoDB. | -| MONGO_USERNAME | [User Defined] | Username for MongoDB. | -| MONGO_PASSWORD | [User Defined] | Password for MongoDB. | +| MONGO_USERNAME | [User Defined] | Admin Username for MongoDB. | +| MONGO_PASSWORD | [User Defined] | Admin Password for MongoDB. | +| MONGO_OPENIM_PASSWORD | [User Defined] | OpenIM Username for MongoDB. | +| MONGO_OPENIM_PASSWORD | [User Defined] | OpenIM Password for MongoDB. | ### 2.8. Tencent Cloud COS Configuration diff --git a/pkg/common/db/unrelation/mongo.go b/pkg/common/db/unrelation/mongo.go index 279a7901e..b8184d767 100644 --- a/pkg/common/db/unrelation/mongo.go +++ b/pkg/common/db/unrelation/mongo.go @@ -78,8 +78,8 @@ func buildMongoURI() string { return config.Config.Mongo.Uri } - username := os.Getenv("MONGO_USERNAME") - password := os.Getenv("MONGO_PASSWORD") + username := os.Getenv("MONGO_OPENIM_USERNAME") + password := os.Getenv("MONGO_OPENIM_PASSWORD") address := os.Getenv("MONGO_ADDRESS") port := os.Getenv("MONGO_PORT") database := os.Getenv("MONGO_DATABASE") diff --git a/scripts/install/dependency.sh b/scripts/install/dependency.sh index bfa0909e2..78995bcf9 100755 --- a/scripts/install/dependency.sh +++ b/scripts/install/dependency.sh @@ -35,8 +35,8 @@ docker run -d \ -e MONGO_INITDB_ROOT_USERNAME=${OPENIM_USER} \ -e MONGO_INITDB_ROOT_PASSWORD=${PASSWORD} \ -e MONGO_INITDB_DATABASE=openIM \ - -e MONGO_USERNAME=${OPENIM_USER} \ - -e MONGO_PASSWORD=${PASSWORD} \ + -e MONGO_OPENIM_USERNAME=${OPENIM_USER} \ + -e MONGO_OPENIM_PASSWORD=${PASSWORD} \ --restart always \ mongo:6.0.2 --wiredTigerCacheSizeGB 1 --auth