summary refs log tree commit diff
path: root/synapse/config/_base.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-04-29 13:34:38 +0100
committerErik Johnston <erik@matrix.org>2015-04-29 13:34:38 +0100
commit64991b0c8ba6f8aefe11ce2d7efcd2363c2ddae3 (patch)
treef2f2f8b40c3949de88ef340cd4f25fa854beca12 /synapse/config/_base.py
parentMerge pull request #135 from matrix-org/erikj/postgres_charset_check (diff)
parentbump database schema version (diff)
downloadsynapse-64991b0c8ba6f8aefe11ce2d7efcd2363c2ddae3.tar.xz
Merge pull request #129 from matrix-org/key_distribution
Key distribution v2
Diffstat (limited to 'synapse/config/_base.py')
-rw-r--r--synapse/config/_base.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/synapse/config/_base.py b/synapse/config/_base.py
index 6017cb6334..b59f4e45e2 100644
--- a/synapse/config/_base.py
+++ b/synapse/config/_base.py
@@ -77,6 +77,17 @@ class Config(object):
         with open(file_path) as file_stream:
             return file_stream.read()
 
+    @classmethod
+    def read_yaml_file(cls, file_path, config_name):
+        cls.check_file(file_path, config_name)
+        with open(file_path) as file_stream:
+            try:
+                return yaml.load(file_stream)
+            except:
+                raise ConfigError(
+                    "Error parsing yaml in file %r" % (file_path,)
+                )
+
     @staticmethod
     def default_path(name):
         return os.path.abspath(os.path.join(os.path.curdir, name))