Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Commit

Permalink
Update users.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
charhart committed Feb 2, 2022
1 parent 69d343d commit 622cb4a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions utilities/ingest-mongo/users.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ var user = '$MONGO_INITDB_ROOT_USERNAME';
var passwd = '$MONGO_INITDB_ROOT_PASSWORD';
var admin = db.getSiblingDB('admin');
admin.auth(user, passwd);
if (db.getUser(user) == null) {
db.createUser({user: user, pwd: passwd, roles: ["dbOwner"]});
}
if (db.getUser("$MONGO_SMARTHUB_USERNAME") == null) {
use $MONGO_SMARTHUB_DATABASE;
db.createUser({ user: "$MONGO_SMARTHUB_USERNAME", pwd: "$MONGO_SMARTHUB_PASSWORD", roles: [ { role: "readWrite", db: "$MONGO_SMARTHUB_DATABASE" } ]});
}
db.createUser({user: user, pwd: passwd, roles: ["dbOwner"]});
use $MONGO_SMARTHUB_DATABASE;
db.createUser({ user: "$MONGO_SMARTHUB_USERNAME", pwd: "$MONGO_SMARTHUB_PASSWORD", roles: [ { role: "readWrite", db: "$MONGO_SMARTHUB_DATABASE" } ]});
EOF

0 comments on commit 622cb4a

Please sign in to comment.