#!/bin/bash

read -sp "Enter MongoDB password: " PASSWORD
echo

# URL encode the password
ENCODED_PASSWORD=$(python3 -c "import urllib.parse; print(urllib.parse.quote('''$PASSWORD'''))")

# Run the Spring Boot app with the encoded password
java -jar cleanup.jar \
  --spring.data.mongodb.uri="mongodb://deploy_admin:$ENCODED_PASSWORD@localhost:27017/source-server?authSource=admin" \
  --spring.data.mongodb.database=source-server
