open-im-server/scripts/mongo-init.sh
Xinwei Xiong(cubxxw) 359e6b1c46 feat: add chmod script
Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>
2023-06-30 22:49:52 +08:00

13 lines
327 B
Bash
Executable File

mongo -- "$MONGO_INITDB_DATABASE" <<EOF
db = db.getSiblingDB('admin')
db.auth('$MONGO_INITDB_ROOT_USERNAME', '$MONGO_INITDB_ROOT_PASSWORD')
db = db.getSiblingDB('$MONGO_INITDB_DATABASE')
db.createUser({
user: "$MONGO_USERNAME",
pwd: "$MONGO_PASSWORD",
roles: [
{ role: 'root', db: '$MONGO_INITDB_DATABASE' }
]
})
EOF