Added Password-Replacement Script for deploy

This commit is contained in:
kB01 2024-02-20 21:57:26 +01:00
parent 6ed0085a07
commit 72ce70b3a8

View file

@ -0,0 +1,64 @@
#!/bin/bash
# Change to Project Directory
cd "$(dirname "$0")/.."
# Search and replace change-me-password-root-db
ROOT_DB_PASSWORD=$(cat /dev/urandom | tr -dc A-Za-z0-9 | fold -w ${1:-30} | head -n 1)
find . -type f -name "docker-compose.yml" -exec sed -i -e 's/change-me-password-root-db/'$ROOT_DB_PASSWORD'/g' {} \;
# Search and replace change-me-password-floodgate-db
FLOODGATE_DB_PASSWORD=$(cat /dev/urandom | tr -dc A-Za-z0-9 | fold -w ${1:-30} | head -n 1)
find ./database -type f -name "*" -exec sed -i -e 's/change-me-password-floodgate-db/'$FLOODGATE_DB_PASSWORD'/g' {} \;
find ./login -type f -name "*" -exec sed -i -e 's/change-me-password-floodgate-db/'$FLOODGATE_DB_PASSWORD'/g' {} \;
find ./proxy -type f -name "*" -exec sed -i -e 's/change-me-password-floodgate-db/'$FLOODGATE_DB_PASSWORD'/g' {} \;
find ./survival -type f -name "*" -exec sed -i -e 's/change-me-password-floodgate-db/'$FLOODGATE_DB_PASSWORD'/g' {} \;
find ./main -type f -name "*" -exec sed -i -e 's/change-me-password-floodgate-db/'$FLOODGATE_DB_PASSWORD'/g' {} \;
# Search and replace change-me-password-advancedban-db
ADVANCEDBAN_DB_PASSWORD=$(cat /dev/urandom | tr -dc A-Za-z0-9 | fold -w ${1:-30} | head -n 1)
find ./database -type f -name "*" -exec sed -i -e 's/change-me-password-advancedban-db/'$ADVANCEDBAN_DB_PASSWORD'/g' {} \;
find ./login -type f -name "*" -exec sed -i -e 's/change-me-password-advancedban-db/'$ADVANCEDBAN_DB_PASSWORD'/g' {} \;
find ./proxy -type f -name "*" -exec sed -i -e 's/change-me-password-advancedban-db/'$ADVANCEDBAN_DB_PASSWORD'/g' {} \;
find ./survival -type f -name "*" -exec sed -i -e 's/change-me-password-advancedban-db/'$ADVANCEDBAN_DB_PASSWORD'/g' {} \;
find ./main -type f -name "*" -exec sed -i -e 's/change-me-password-advancedban-db/'$ADVANCEDBAN_DB_PASSWORD'/g' {} \;
# Search and replace change-me-password-luckperms-db
LUCKPERMS_DB_PASSWORD=$(cat /dev/urandom | tr -dc A-Za-z0-9 | fold -w ${1:-30} | head -n 1)
find ./database -type f -name "*" -exec sed -i -e 's/change-me-password-luckperms-db/'$LUCKPERMS_DB_PASSWORD'/g' {} \;
find ./login -type f -name "*" -exec sed -i -e 's/change-me-password-luckperms-db/'$LUCKPERMS_DB_PASSWORD'/g' {} \;
find ./proxy -type f -name "*" -exec sed -i -e 's/change-me-password-luckperms-db/'$LUCKPERMS_DB_PASSWORD'/g' {} \;
find ./survival -type f -name "*" -exec sed -i -e 's/change-me-password-luckperms-db/'$LUCKPERMS_DB_PASSWORD'/g' {} \;
find ./main -type f -name "*" -exec sed -i -e 's/change-me-password-luckperms-db/'$LUCKPERMS_DB_PASSWORD'/g' {} \;
# Search and replace change-me-password-btm-db
BTM_DB_PASSWORD=$(cat /dev/urandom | tr -dc A-Za-z0-9 | fold -w ${1:-30} | head -n 1)
find ./database -type f -name "*" -exec sed -i -e 's/change-me-password-btm-db/'$BTM_DB_PASSWORD'/g' {} \;
find ./login -type f -name "*" -exec sed -i -e 's/change-me-password-btm-db/'$BTM_DB_PASSWORD'/g' {} \;
find ./proxy -type f -name "*" -exec sed -i -e 's/change-me-password-btm-db/'$BTM_DB_PASSWORD'/g' {} \;
find ./survival -type f -name "*" -exec sed -i -e 's/change-me-password-btm-db/'$BTM_DB_PASSWORD'/g' {} \;
find ./main -type f -name "*" -exec sed -i -e 's/change-me-password-btm-db/'$BTM_DB_PASSWORD'/g' {} \;
# Search and replace change-me-password-plot-db
PLOT_DB_PASSWORD=$(cat /dev/urandom | tr -dc A-Za-z0-9 | fold -w ${1:-30} | head -n 1)
find ./database -type f -name "*" -exec sed -i -e 's/change-me-password-plot-db/'$PLOT_DB_PASSWORD'/g' {} \;
find ./login -type f -name "*" -exec sed -i -e 's/change-me-password-plot-db/'$PLOT_DB_PASSWORD'/g' {} \;
find ./proxy -type f -name "*" -exec sed -i -e 's/change-me-password-plot-db/'$PLOT_DB_PASSWORD'/g' {} \;
find ./survival -type f -name "*" -exec sed -i -e 's/change-me-password-plot-db/'$PLOT_DB_PASSWORD'/g' {} \;
find ./main -type f -name "*" -exec sed -i -e 's/change-me-password-plot-db/'$PLOT_DB_PASSWORD'/g' {} \;
# Search and replace change-me-password-rewards-db
REWARDS_DB_PASSWORD=$(cat /dev/urandom | tr -dc A-Za-z0-9 | fold -w ${1:-30} | head -n 1)
find ./database -type f -name "*" -exec sed -i -e 's/change-me-password-rewards-db/'$REWARDS_DB_PASSWORD'/g' {} \;
find ./login -type f -name "*" -exec sed -i -e 's/change-me-password-rewards-db/'$REWARDS_DB_PASSWORD'/g' {} \;
find ./proxy -type f -name "*" -exec sed -i -e 's/change-me-password-rewards-db/'$REWARDS_DB_PASSWORD'/g' {} \;
find ./survival -type f -name "*" -exec sed -i -e 's/change-me-password-rewards-db/'$REWARDS_DB_PASSWORD'/g' {} \;
find ./main -type f -name "*" -exec sed -i -e 's/change-me-password-rewards-db/'$REWARDS_DB_PASSWORD'/g' {} \;
# Search and replace change-me-password-economy-db
ECONOMY_DB_PASSWORD=$(cat /dev/urandom | tr -dc A-Za-z0-9 | fold -w ${1:-30} | head -n 1)
find ./database -type f -name "*" -exec sed -i -e 's/change-me-password-economy-db/'$ECONOMY_DB_PASSWORD'/g' {} \;
find ./login -type f -name "*" -exec sed -i -e 's/change-me-password-economy-db/'$ECONOMY_DB_PASSWORD'/g' {} \;
find ./proxy -type f -name "*" -exec sed -i -e 's/change-me-password-economy-db/'$ECONOMY_DB_PASSWORD'/g' {} \;
find ./survival -type f -name "*" -exec sed -i -e 's/change-me-password-economy-db/'$ECONOMY_DB_PASSWORD'/g' {} \;
find ./main -type f -name "*" -exec sed -i -e 's/change-me-password-economy-db/'$ECONOMY_DB_PASSWORD'/g' {} \;