allow reading config by dot

This commit is contained in:
Jake Howard 2017-03-29 18:50:12 +01:00
parent 7173bee935
commit 5ab9211958
3 changed files with 4 additions and 2 deletions

View file

@ -1,8 +1,9 @@
import yaml import yaml
from dotmap import DotMap
import os import os
from md_pdf.consts import CONFIG_FILE from md_pdf.consts import CONFIG_FILE
def load_config(): def load_config():
with open(os.path.join(CONFIG_FILE)) as f: with open(os.path.join(CONFIG_FILE)) as f:
return yaml.load(f) return DotMap(yaml.load(f))

View file

@ -10,7 +10,7 @@ REQUIRED_KEYS = [
def check_required_keys(config): def check_required_keys(config):
missing_keys = [key for key in REQUIRED_KEYS if key not in config] missing_keys = [key for key in REQUIRED_KEYS if key not in config]
if missing_keys: if missing_keys:
raise ConfigValidationException("Missing required keys: {}".format(missing_keys)) raise ConfigValidationException("Missing required keys: {}".format(", ".join(missing_keys)))
def validate_config(config): def validate_config(config):

View file

@ -6,6 +6,7 @@ setup(
version="1.0", version="1.0",
install_requires=[ install_requires=[
"beautifulsoup4==4.5.3", "beautifulsoup4==4.5.3",
"dotmap==1.2.17",
"jinja2==2.9.5", "jinja2==2.9.5",
"pdfkit==0.6.1", "pdfkit==0.6.1",
"pypandoc==1.3.3", "pypandoc==1.3.3",