You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
332 B
13 lines
332 B
2 years ago
|
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: 'readWrite', db: '$MONGO_INITDB_DATABASE' }
|
||
|
]
|
||
|
})
|
||
|
EOF
|