12 lines
394 B
Bash
12 lines
394 B
Bash
|
|
#!/bin/bash
|
||
|
|
# Creates the explorer app user in explorerdb.
|
||
|
|
# Runs once on first container start (only when the data volume is empty).
|
||
|
|
mongosh -u "$MONGO_INITDB_ROOT_USERNAME" -p "$MONGO_INITDB_ROOT_PASSWORD" --authenticationDatabase admin <<EOF
|
||
|
|
use $MONGO_APP_DB
|
||
|
|
db.createUser({
|
||
|
|
user: "$MONGO_APP_USER",
|
||
|
|
pwd: "$MONGO_APP_PASS",
|
||
|
|
roles: [{ role: "readWrite", db: "$MONGO_APP_DB" }]
|
||
|
|
})
|
||
|
|
EOF
|