30 lines
929 B
Bash
Executable File
30 lines
929 B
Bash
Executable File
#!/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 compose run --rm \
|
|
-e SYNAPSE_SERVER_NAME="$DOMAIN" \
|
|
-e SYNAPSE_REPORT_STATS=no \
|
|
synapse generate
|
|
|
|
# Generate and display the registration shared secret
|
|
SHARED_SECRET=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 50)
|
|
echo
|
|
echo "Registration shared secret: $SHARED_SECRET"
|
|
echo "Database URI: postgres://synapse:$DB_PASSWORD@postgres/synapse?sslmode=disable"
|
|
echo
|
|
echo "Make sure to save this information securely!"
|