summary refs log tree commit diff
path: root/synapse/config
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2016-05-16 13:03:59 +0100
committerMark Haines <mark.haines@matrix.org>2016-05-16 13:03:59 +0100
commiteb79110beb79c639d75b26f6c5832a8192776a8f (patch)
tree7f7cff56157068180daef95e1994af8d22f107d7 /synapse/config
parentMerge branch 'develop' into matthew/preview_url_ip_whitelist (diff)
downloadsynapse-eb79110beb79c639d75b26f6c5832a8192776a8f.tar.xz
Clean up the blacklist/whitelist handling.
Always set the config key with an empty list, even if a list isn't specified.
This means that the codepaths are the same for both the empty list and
for a missing key. Since the behaviour is the same for both cases this
makes the code somewhat easier to reason about.
Diffstat (limited to 'synapse/config')
-rw-r--r--synapse/config/repository.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/synapse/config/repository.py b/synapse/config/repository.py
index 44224424f6..8810079848 100644
--- a/synapse/config/repository.py
+++ b/synapse/config/repository.py
@@ -100,13 +100,13 @@ class ContentRepositoryConfig(Config):
                     "to work"
                 )
 
-            if "url_preview_ip_range_whitelist" in config:
-                self.url_preview_ip_range_whitelist = IPSet(
-                    config["url_preview_ip_range_whitelist"]
-                )
+            self.url_preview_ip_range_whitelist = IPSet(
+                config.get("url_preview_ip_range_whitelist", ())
+            )
 
-            if "url_preview_url_blacklist" in config:
-                self.url_preview_url_blacklist = config["url_preview_url_blacklist"]
+            self.url_preview_url_blacklist = config.get(
+                "url_preview_url_blacklist", ()
+            )
 
     def default_config(self, **kwargs):
         media_store = self.default_path("media_store")