chuwi-minibook-tablet-mode/tabletmode/config.py
2020-03-26 11:47:41 +01:00

23 lines
491 B
Python

"""Configuration file parsing."""
from json import load
from logging import getLogger
from pathlib import Path
__all__ = ['load_configuration']
CONFIG_FILE = Path('/etc/tablet-mode.json')
LOGGER = getLogger('tabletmode')
def load_configuration():
"""Returns the configuration."""
try:
with CONFIG_FILE.open('r') as cfg:
return load(cfg)
except FileNotFoundError:
LOGGER.warning('Config file %s does not exist.', CONFIG_FILE)
return {}