summary refs log tree commit diff
path: root/synapse/config/emailconfig.py
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2016-04-27 15:09:55 +0100
committerDavid Baker <dave@matrix.org>2016-04-27 15:09:55 +0100
commitfa12209c1b297a1710f487744a8a143d6cb6a2d1 (patch)
treefbaa9f9219946cb349351e5afca62b97e4105d7d /synapse/config/emailconfig.py
parentMore variable calculation for email notifs (diff)
downloadsynapse-fa12209c1b297a1710f487744a8a143d6cb6a2d1.tar.xz
Hopefully all remaining bits for email notifs
Add public facing base url to the server so synapse knows what URL to use when converting mxc to http urls for use in emails
Diffstat (limited to 'synapse/config/emailconfig.py')
-rw-r--r--synapse/config/emailconfig.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/synapse/config/emailconfig.py b/synapse/config/emailconfig.py
index 68fb4d8060..893034e2ef 100644
--- a/synapse/config/emailconfig.py
+++ b/synapse/config/emailconfig.py
@@ -25,17 +25,19 @@ class EmailConfig(Config):
     """
 
     def read_config(self, config):
+        self.email_enable_notifs = False
+
         email_config = config.get("email", None)
         if email_config:
             self.email_enable_notifs = email_config.get("enable_notifs", True)
 
+        if self.email_enable_notifs:
             required = [
                 "smtp_host",
                 "smtp_port",
                 "notif_from",
                 "template_dir",
                 "notif_template_html",
-
             ]
 
             missing = []
@@ -49,6 +51,11 @@ class EmailConfig(Config):
                     (", ".join(["email."+k for k in missing]),)
                 )
 
+            if config.get("public_baseurl") is None:
+                raise RuntimeError(
+                    "email.enable_notifs is True but no public_baseurl is set"
+                )
+
             self.email_smtp_host = email_config["smtp_host"]
             self.email_smtp_port = email_config["smtp_port"]
             self.email_notif_from = email_config["notif_from"]