summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-06-12 17:41:36 +0100
committerErik Johnston <erik@matrix.org>2015-06-12 17:44:23 +0100
commita005b7269a9c1df517f6a01e72c1eea5f4cb0354 (patch)
tree598d255f02328f56fb9d0fc340cb2666d8b1354b /synapse
parentFix tests (diff)
downloadsynapse-a005b7269a9c1df517f6a01e72c1eea5f4cb0354.tar.xz
Add backwards compat support for metrics, manhole and webclient config options
Diffstat (limited to 'synapse')
-rwxr-xr-xsynapse/app/homeserver.py7
-rw-r--r--synapse/config/metrics.py6
-rw-r--r--synapse/config/server.py30
3 files changed, 27 insertions, 16 deletions
diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py
index 91cc06a49e..95e9122d3e 100755
--- a/synapse/app/homeserver.py
+++ b/synapse/app/homeserver.py
@@ -408,13 +408,6 @@ def setup(config_options):
 
     logger.info("Database prepared in %r.", config.database_config)
 
-    if config.manhole:
-        f = twisted.manhole.telnet.ShellFactory()
-        f.username = "matrix"
-        f.password = "rabbithole"
-        f.namespace['hs'] = hs
-        reactor.listenTCP(config.manhole, f, interface='127.0.0.1')
-
     hs.start_listening()
 
     hs.get_pusherpool().start()
diff --git a/synapse/config/metrics.py b/synapse/config/metrics.py
index 0cfb30ce7f..ae5a691527 100644
--- a/synapse/config/metrics.py
+++ b/synapse/config/metrics.py
@@ -28,10 +28,4 @@ class MetricsConfig(Config):
 
         # Enable collection and rendering of performance metrics
         enable_metrics: False
-
-        # Separate port to accept metrics requests on
-        # metrics_port: 8081
-
-        # Which host to bind the metric listener to
-        # metrics_bind_host: 127.0.0.1
         """
diff --git a/synapse/config/server.py b/synapse/config/server.py
index 9dab167b21..95bc967d0e 100644
--- a/synapse/config/server.py
+++ b/synapse/config/server.py
@@ -20,7 +20,6 @@ class ServerConfig(Config):
 
     def read_config(self, config):
         self.server_name = config["server_name"]
-        self.manhole = config.get("manhole")
         self.pid_file = self.abspath(config.get("pid_file"))
         self.web_client = config["web_client"]
         self.soft_file_limit = config["soft_file_limit"]
@@ -35,6 +34,8 @@ class ServerConfig(Config):
             bind_host = config.get("bind_host", "")
             gzip_responses = config.get("gzip_responses", True)
 
+            names = ["client", "webclient"] if self.web_client else ["client"]
+
             self.listeners.append({
                 "port": bind_port,
                 "bind_address": bind_host,
@@ -42,7 +43,7 @@ class ServerConfig(Config):
                 "type": "http",
                 "resources": [
                     {
-                        "names": ["client", "webclient"],
+                        "names": names,
                         "compress": gzip_responses,
                     },
                     {
@@ -61,7 +62,7 @@ class ServerConfig(Config):
                     "type": "http",
                     "resources": [
                         {
-                            "names": ["client", "webclient"],
+                            "names": names,
                             "compress": gzip_responses,
                         },
                         {
@@ -71,6 +72,29 @@ class ServerConfig(Config):
                     ]
                 })
 
+        manhole = config.get("manhole")
+        if manhole:
+            self.listeners.append({
+                "port": manhole,
+                "bind_address": "127.0.0.1",
+                "type": "manhole",
+            })
+
+        metrics_port = config.get("metrics_port")
+        if metrics_port:
+            self.listeners.append({
+                "port": metrics_port,
+                "bind_address": config.get("metrics_bind_host", "127.0.0.1"),
+                "tls": False,
+                "type": "http",
+                "resources": [
+                    {
+                        "names": ["metrics"],
+                        "compress": False,
+                    },
+                ]
+            })
+
         # Attempt to guess the content_addr for the v0 content repostitory
         content_addr = config.get("content_addr")
         if not content_addr: