diff --git a/synapse/hooks/init b/synapse/hooks/init index 0ad6d36..dfdcbf8 100755 --- a/synapse/hooks/init +++ b/synapse/hooks/init @@ -19,6 +19,8 @@ options="$(e "$service_def" | shyaml -y get-value options)" || true SYNAPSE_OPTIONS=( + + server-name:string ## The server name report-stats:bool ## Enable anon stat reporting back to the Matrix project enable-registration:bool ## Enable registration on the Synapse instance. allow-guest:bool ## allow guest joining this server. diff --git a/synapse/hooks/web_proxy-relation-joined b/synapse/hooks/web_proxy-relation-joined index 4e3e1f2..742f0e0 100755 --- a/synapse/hooks/web_proxy-relation-joined +++ b/synapse/hooks/web_proxy-relation-joined @@ -4,20 +4,23 @@ set -e . lib/common -DOMAIN=$(relation-get domain) || exit 1 +env=() url=$(relation-get url) - if [ "${url%://*}" == "https" ]; then - no_tls=" SYNAPSE_NO_TLS: 'yes'" -else - no_tls= + env+=(SYNAPSE_NO_TLS "'yes'") +fi + +server_name=$(options-get "server-name") || true +if [ -z "$server_name" ]; then + DOMAIN=$(relation-get domain) || exit 1 + env+=(SYNAPSE_SERVER_NAME "$DOMAIN") fi -init-config-add " +if [ "${#env[@]}" -gt 0 ]; then + init-config-add " $SERVICE_NAME: environment: - SYNAPSE_SERVER_NAME: $DOMAIN -$no_tls +$(printf " %s: %s\n" "${env[@]}") " || exit 1 - +fi \ No newline at end of file