PromucFlow_constructor/deploy/docker/templates/mongo-init.js.sh
Shrikant Sharat Kandula f0a61285a6
docs: Fat container documentation fixes (#7207)
Added additional details about how to use the fat container, and how to manage / maintain it.

Also includes some refactorings that shouldn't affect the functionality significantly.
2021-09-14 19:01:06 +05:30

34 lines
579 B
Bash

#!/bin/bash
set -o nounset
MONGO_ROOT_USER="$1"
MONGO_ROOT_PASSWORD="$2"
cat <<EOF
let error = false
print("**** Going to start Mongo seed ****")
var admin = db.getSiblingDB("admin")
admin.auth("$MONGO_ROOT_USER", "$MONGO_ROOT_PASSWORD")
let res = [
db.createUser(
{
user: "$MONGO_ROOT_USER",
pwd: "$MONGO_ROOT_PASSWORD",
roles: [{
role: "root",
db: "admin"
}, "readWrite"]
}
)
]
printjson(res)
if (error) {
print('Error occurred while inserting the records')
}
EOF