mirror of
https://github.com/Haxxnet/Compose-Examples.git
synced 2026-04-02 04:35:36 +02:00
chore: add v7 fallback
This commit is contained in:
20
examples/unify-network-application/init-mongo-v7.sh
Normal file
20
examples/unify-network-application/init-mongo-v7.sh
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
: "${MONGO_USER:?Missing MONGO_USER}"
|
||||
: "${MONGO_PASS:?Missing MONGO_PASS}"
|
||||
: "${MONGO_DBNAME:?Missing MONGO_DBNAME}"
|
||||
|
||||
mongo --quiet <<EOF
|
||||
db.getSiblingDB("${MONGO_DBNAME}").createUser({
|
||||
user: "${MONGO_USER}",
|
||||
pwd: "${MONGO_PASS}",
|
||||
roles: [{ role: "readWrite", db: "${MONGO_DBNAME}" }]
|
||||
});
|
||||
|
||||
db.getSiblingDB("${MONGO_DBNAME}_stat").createUser({
|
||||
user: "${MONGO_USER}",
|
||||
pwd: "${MONGO_PASS}",
|
||||
roles: [{ role: "readWrite", db: "${MONGO_DBNAME}_stat" }]
|
||||
});
|
||||
EOF
|
||||
Reference in New Issue
Block a user