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

13 lines
356 B
Python
Raw Normal View History

2017-03-29 18:26:54 +01:00
import yaml
import os
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
def load_config():
2017-03-30 16:19:31 +01:00
try:
with open(os.path.join(CONFIG_FILE)) 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))