Skip to content

Commit

Permalink
dont crash on user already exists error
Browse files Browse the repository at this point in the history
  • Loading branch information
Anemy committed Dec 23, 2023
1 parent f043274 commit dfdf4d9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docker/oidc/mock-oidc-provider/start-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ until nc -z localhost 27017; do
sleep 1
done
# Creates the OIDC user role in the database.
mongosh "mongodb://localhost:27017/admin" --json --eval "(process.env.OIDC_TOKEN_PAYLOAD_GROUPS ?? 'testgroup').split(',').map(group => db.createRole({ role: 'dev/' + group, privileges: [ ], roles: [ \"readWriteAnyDatabase\" ] }));"
mongosh "mongodb://localhost:27017/admin" --json --eval "try {(process.env.OIDC_TOKEN_PAYLOAD_GROUPS ?? 'testgroup').split(',').map(group => db.createRole({ role: 'dev/' + group, privileges: [ ], roles: [ \"readWriteAnyDatabase\" ] })); } catch (err) { /* The user likely already exists. */ if (!err.message.includes('already exists')) { throw err; } }"

# Stop the no auth database (we re-start it with auth enabled next).
pkill mongod
Expand Down

0 comments on commit dfdf4d9

Please sign in to comment.