Package: matrix-synapse
Version: 0.19.2+dfsg-4
Severity: normal
Tags: patch

Dear Maintainer,

Currently if the domain name is not known, and the user simply presses enter on 
the
debconf page, the install completes but the 
/etc/matrix-synapse/conf.d/server_name.yaml
is not written and a package installtion error happens. This prevents that by 
failing gracefully.

Also domain name cannot be changed after its configured and the service is used.
This allows the user to make an informed decision before setting a proper 
domain 
name rather that something temporary which is hard to be changed later on.

I have also raised this with the upstream developers too.
>From 7fb9a42437c09e8821541f26bf137b513b7ac343 Mon Sep 17 00:00:00 2001
From: Rahul De <rahul080...@gmail.com>
Date: Mon, 13 Mar 2017 14:12:52 +0530
Subject: [PATCH] Fail silently if server name is not configured

- This is for the scenario of the user not setting the server name in debconf 
when the FQDN isn't known.
- That results in /etc/matrix-synapse/conf.d/server_name.yaml not being present.
- This prevents the service from starting util the file is present.
---
 debian/matrix-synapse.init    | 4 ++++
 debian/matrix-synapse.service | 1 +
 2 files changed, 5 insertions(+)

diff --git a/debian/matrix-synapse.init b/debian/matrix-synapse.init
index 905bd3c..9d27bca 100755
--- a/debian/matrix-synapse.init
+++ b/debian/matrix-synapse.init
@@ -20,6 +20,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin
 DESC="matrix-synapse"
 NAME=matrix-synapse
 SCRIPTNAME=/etc/init.d/$NAME
+CONFIGFILE_SERVERNAME="/etc/matrix-synapse/conf.d/server_name.yaml"
 
 PYTHON="/usr/bin/python"
 CONFIGS="--config-path /etc/matrix-synapse/homeserver.yaml --config-path 
/etc/matrix-synapse/conf.d/"
@@ -50,6 +51,9 @@ get_config_key()
 #
 do_start()
 {
+       # Fail silently if CONFIGFILE_SERVERNAME doesn't exist
+       [ -f $CONFIGFILE_SERVERNAME ] || return 0
+
        # Running --generate-config to create keys if any are absent.
        # Doesn't matter if not
        $PYTHON -m "synapse.app.homeserver" $CONFIGS --generate-keys || return 2
diff --git a/debian/matrix-synapse.service b/debian/matrix-synapse.service
index ab94e07..fe9bf89 100644
--- a/debian/matrix-synapse.service
+++ b/debian/matrix-synapse.service
@@ -1,5 +1,6 @@
 [Unit]
 Description=Synapse Matrix homeserver
+ConditionPathExists=/etc/matrix-synapse/conf.d/server_name.yaml
 
 [Service]
 Type=simple
-- 
2.12.0

Reply via email to