1
0
Fork 0
mirror of synced 2024-06-02 15:31:09 -04:00
dotbot/dotbot/config.py
Anish Athalye 33d602bb93 Add YAML support
Add support for YAML format configuration files. In addition, this
commit adds instructions about YAML config files to the README, and it
also changes the README to encourage use of YAML instead of JSON.
2014-10-27 20:31:40 -04:00

20 lines
481 B
Python

import yaml
class ConfigReader(object):
def __init__(self, config_file_path):
self._config = self._read(config_file_path)
def _read(self, config_file_path):
try:
with open(config_file_path) as fin:
data = yaml.load(fin)
return data
except Exception:
raise ReadingError('Could not read config file')
def get_config(self):
return self._config
class ReadingError(Exception):
pass