Multiple endpoints might want a common configuration settings, so it would be nice to have a _common.yaml file be loaded and then per-endpoint configurations be (recursively) merged in.
Sketch for recursive merging:
def merge(base, *args):
out = base.copy()
for arg in args:
for key, value in arg.items():
if key not in out:
out[key] = value
elif type(key) == list:
if type(out[key]) == list:
out[key] += value
else:
raise
elif type(key) == dict:
if type(out[key]) == dict:
out[key] = merge(out[key], value)
else:
raise
else:
out[key] = value
return out
Multiple endpoints might want a common configuration settings, so it would be nice to have a
_common.yaml
file be loaded and then per-endpoint configurations be (recursively) merged in.Sketch for recursive merging: