#!/bin/bash # Generate DB password DB_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32) # Replace the default password in docker-compose.yml sed -i "s/POSTGRES_PASSWORD: itsasecret/POSTGRES_PASSWORD: $DB_PASSWORD/" docker-compose.yml # Prompt for domain input read -p "Enter your domain (e.g., example.com): " DOMAIN if [[ -z "$DOMAIN" ]]; then echo "Domain cannot be empty. Exiting." exit 1 fi # Generate configuration echo "Generating configuration with domain: $DOMAIN..." docker run -it --rm \ -v $(pwd)/config/synapse:/data \ -e SYNAPSE_SERVER_NAME="$DOMAIN" \ -e SYNAPSE_REPORT_STATS=no \ matrixdotorg/synapse:latest generate echo "Database info:" echo " - Host: postgres" echo " - Username: synapse" echo " - Password: $DB_PASSWORD" echo " - Database: synapse" echo "Database URI: postgres://synapse:$DB_PASSWORD@postgres/synapse?sslmode=disable" echo echo "Make sure to save this information securely!"