Add a config file for perspective servers

This commit is contained in:
Mark Haines 2015-04-24 11:26:19 +01:00
parent 31e262e6b4
commit b1e68add19
2 changed files with 30 additions and 0 deletions

View file

@ -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))