statcheck/common.py
2024-08-31 16:28:47 -04:00

17 lines
432 B
Python

from os.path import dirname, join, exists
import yaml
def read_config(path):
if path == '':
return {}
# Config deeper in the hierarchy can override config files from
# higher up in the hierarchy:
result = read_config(dirname(path))
config_file = join(path, ".democonfig")
if exists(config_file):
with open(config_file) as f:
result.update(yaml.safe_load(f))
return result