Skip to content

Commit 2e5902f

Browse files
committed
use one liners for mongo commands
1 parent e49d071 commit 2e5902f

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

docker/scripts/setup-krb5-mongo.sh

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,5 @@ echo "Started.."
1313

1414
# create role with anyAction on all resources (needed to allow exporter run execute commands)
1515
# create mongodb user using the same username as the kerberos principal
16-
mongosh --host 127.0.0.1:27017 -u ${username} -p ${password} <<EOF
17-
db.getSiblingDB("admin").createRole({
18-
role: "anyAction",
19-
privileges: [
20-
{ resource: { anyResource: true }, actions: [ "anyAction" ] }
21-
],
22-
roles: []
23-
});
24-
db.getSiblingDB("\$external").createUser({user: "[email protected]",roles: [{role: "anyAction", db: "admin"}]});
25-
EOF
16+
mongosh --host 127.0.0.1:27017 -u "$username" -p "$password" --eval 'db.getSiblingDB("admin").createRole({role: "anyAction", privileges: [{ resource: { anyResource: true }, actions: [ "anyAction" ] }], roles: [] });'
17+
mongosh --host 127.0.0.1:27017 -u "$username" -p "$password" --eval 'db.getSiblingDB("$external").createUser({user: "[email protected]", roles: [{role: "anyAction", db: "admin"}]});'

0 commit comments

Comments
 (0)