summary refs log tree commit diff
path: root/synapse/config/tls.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-03-06 11:34:06 +0000
committerErik Johnston <erik@matrix.org>2015-03-06 11:34:06 +0000
commit3ce8540484a3cc29ce2970ebf6608b6fd3359931 (patch)
treef822a98ea71d21d477693dac7a3bd31f83d2f549 /synapse/config/tls.py
parentMerge pull request #102 from matrix-org/randomize_stream_timeout (diff)
downloadsynapse-3ce8540484a3cc29ce2970ebf6608b6fd3359931.tar.xz
Don't look for an TLS private key if we have set --no-tls
Diffstat (limited to '')
-rw-r--r--synapse/config/tls.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/synapse/config/tls.py b/synapse/config/tls.py
index 384b29e7ba..a45bf6d521 100644
--- a/synapse/config/tls.py
+++ b/synapse/config/tls.py
@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from ._base import Config
+from ._base import Config, ConfigError
 
 from OpenSSL import crypto
 import subprocess
@@ -28,9 +28,16 @@ class TlsConfig(Config):
         self.tls_certificate = self.read_tls_certificate(
             args.tls_certificate_path
         )
-        self.tls_private_key = self.read_tls_private_key(
-            args.tls_private_key_path
-        )
+
+        self.no_tls = args.no_tls
+
+        if self.no_tls:
+            self.tls_private_key = None
+        else:
+            self.tls_private_key = self.read_tls_private_key(
+                args.tls_private_key_path
+            )
+
         self.tls_dh_params_path = self.check_file(
             args.tls_dh_params_path, "tls_dh_params"
         )
@@ -45,6 +52,8 @@ class TlsConfig(Config):
                                help="PEM encoded private key for TLS")
         tls_group.add_argument("--tls-dh-params-path",
                                help="PEM dh parameters for ephemeral keys")
+        tls_group.add_argument("--no-tls", action='store_true',
+                               help="Don't bind to the https port.")
 
     def read_tls_certificate(self, cert_path):
         cert_pem = self.read_file(cert_path, "tls_certificate")