This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
md-pdf/md_pdf/config/read.py

12 lines
349 B
Python
Raw Normal View History

2017-03-29 18:26:54 +01:00
import yaml
from md_pdf.consts import CONFIG_FILE
2017-03-30 16:19:31 +01:00
from md_pdf.exceptions import ConfigValidationException
2017-03-29 18:26:54 +01:00
2017-05-27 20:32:50 +01:00
def load_config(location=CONFIG_FILE):
2017-03-30 16:19:31 +01:00
try:
2017-06-08 12:26:15 +01:00
with open(location) as f:
2017-03-30 18:34:32 +01:00
return yaml.safe_load(f)
2017-03-30 16:19:31 +01:00
except FileNotFoundError:
raise ConfigValidationException("Can't find config file at {}".format(CONFIG_FILE))