summary refs log tree commit diff
path: root/synapse/config/appservice.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-09-02 11:04:48 +0100
committerErik Johnston <erik@matrix.org>2016-09-02 11:04:48 +0100
commit657847e4c6b955911768e7d3025ac1b245208882 (patch)
treea826411c63b4691a7356ce2740e7b4438b8ead78 /synapse/config/appservice.py
parentLimit the length of state chains (diff)
parentMerge pull request #1061 from matrix-org/erikj/linearize_resolution (diff)
downloadsynapse-657847e4c6b955911768e7d3025ac1b245208882.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/state_storage
Diffstat (limited to 'synapse/config/appservice.py')
-rw-r--r--synapse/config/appservice.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/synapse/config/appservice.py b/synapse/config/appservice.py
index dfe43b0b4c..d7537e8d44 100644
--- a/synapse/config/appservice.py
+++ b/synapse/config/appservice.py
@@ -86,7 +86,7 @@ def load_appservices(hostname, config_files):
 
 def _load_appservice(hostname, as_info, config_filename):
     required_string_fields = [
-        "id", "url", "as_token", "hs_token", "sender_localpart"
+        "id", "as_token", "hs_token", "sender_localpart"
     ]
     for field in required_string_fields:
         if not isinstance(as_info.get(field), basestring):
@@ -94,6 +94,14 @@ def _load_appservice(hostname, as_info, config_filename):
                 field, config_filename,
             ))
 
+    # 'url' must either be a string or explicitly null, not missing
+    # to avoid accidentally turning off push for ASes.
+    if (not isinstance(as_info.get("url"), basestring) and
+            as_info.get("url", "") is not None):
+        raise KeyError(
+            "Required string field or explicit null: 'url' (%s)" % (config_filename,)
+        )
+
     localpart = as_info["sender_localpart"]
     if urllib.quote(localpart) != localpart:
         raise ValueError(
@@ -132,6 +140,13 @@ def _load_appservice(hostname, as_info, config_filename):
         for p in protocols:
             if not isinstance(p, str):
                 raise KeyError("Bad value for 'protocols' item")
+
+    if as_info["url"] is None:
+        logger.info(
+            "(%s) Explicitly empty 'url' provided. This application service"
+            " will not receive events or queries.",
+            config_filename,
+        )
     return ApplicationService(
         token=as_info["as_token"],
         url=as_info["url"],