diff options
author | Mark Haines <mark.haines@matrix.org> | 2015-04-24 11:26:19 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2015-04-24 11:26:19 +0100 |
commit | b1e68add1992d0072aa37f3bdf07dc226200fe5d (patch) | |
tree | 13e7f781892d10206c521978fce43bc4b3e6c0fc /synapse/config/_base.py | |
parent | Copyright notice (diff) | |
download | synapse-b1e68add1992d0072aa37f3bdf07dc226200fe5d.tar.xz |
Add a config file for perspective servers
Diffstat (limited to 'synapse/config/_base.py')
-rw-r--r-- | synapse/config/_base.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/synapse/config/_base.py b/synapse/config/_base.py index 87cdbf1d30..f07ea4cc46 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 Exception as e: + raise ConfigError( + "Error parsing yaml in file %r: " % (file_path,), e + ) + @staticmethod def default_path(name): return os.path.abspath(os.path.join(os.path.curdir, name)) |