From 349bbfd4525705a3a88e320c453f3543fbeb6364 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Wed, 8 Apr 2020 19:14:47 -0700 Subject: [PATCH] set server_name at install time --- start.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/start.sh b/start.sh index 49e1d99..503c309 100755 --- a/start.sh +++ b/start.sh @@ -7,8 +7,11 @@ mkdir -p /app/data/data /app/data/configs /run/synapse if [[ ! -f /app/data/configs/homeserver.yaml ]]; then echo "==> Detected first run" + # this is set at installation time and not changed after + server_name=$(python -c "from publicsuffix2 import get_sld; print(get_sld('${CLOUDRON_APP_DOMAIN}'));") + python3 -m synapse.app.homeserver \ - --server-name ${CLOUDRON_APP_DOMAIN} \ + --server-name ${server_name} \ --config-path /app/data/configs/homeserver.yaml \ --config-directory /app/data/configs \ --data-directory /app/data/data \ @@ -17,16 +20,13 @@ if [[ ! -f /app/data/configs/homeserver.yaml ]]; then # fix logging configuration cp /app/pkg/homeserver.yaml.template /app/data/configs/homeserver.yaml - mv /app/data/configs/${CLOUDRON_APP_DOMAIN}.log.config /app/data/configs/log.config + mv /app/data/configs/${server_name}.log.config /app/data/configs/log.config yq w -i /app/data/configs/homeserver.yaml log_config /app/data/configs/log.config yq w -i /app/data/configs/log.config handlers.file.filename /run/synapse/homeserver.log - mv /app/data/configs/${CLOUDRON_APP_DOMAIN}.signing.key /app/data/configs/signing.key - - # this is set at installation time and not changed after - server_name=$(python -c "from publicsuffix2 import get_sld; print(get_sld('${CLOUDRON_APP_DOMAIN}'));") - yq w -i /app/data/configs/homeserver.yaml server_name "${CLOUDRON_APP_DOMAIN}" + mv /app/data/configs/${server_name}.signing.key /app/data/configs/signing.key + yq w -i /app/data/configs/homeserver.yaml server_name "${server_name}" yq w -i /app/data/configs/homeserver.yaml registration_shared_secret "$(pwgen -1s 64)" fi