makeUserAdmin.sh 410 B

123456789101112
  1. #!/bin/bash
  2. USERNAME=$1
  3. MONGO_MUSARE_PASSWORD=$2
  4. if [[ -n $USERNAME ]] && [[ -n $MONGO_MUSARE_PASSWORD ]];
  5. then
  6. echo "Attemtping to make '$USERNAME' an admin"
  7. docker-compose exec mongo mongo musare -u musare -p $MONGO_MUSARE_PASSWORD --eval "db.users.update({username: '$USERNAME'}, {\$set: {role: 'admin'}})"
  8. else
  9. echo "Syntax: makeUserAdmin MUSARE_USERNAME MONGO_MUSARE_PASSWORD"
  10. fi