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

14 lines
385 B
Python
Raw Normal View History

2017-03-29 18:26:54 +01:00
import yaml
2017-03-29 18:50:12 +01:00
from dotmap import DotMap
2017-03-29 18:26:54 +01:00
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:
return DotMap(yaml.load(f))
except FileNotFoundError:
raise ConfigValidationException("Can't find config file at {}".format(CONFIG_FILE))