blob: e56931177c123afb59d5d9deacd0bdf1ddd8076e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
import os
import yaml
def merge(left, right):
for key in right:
if key in left:
if isinstance(left[key], dict) and isinstance(right[key], dict):
merge(left[key], right[key])
elif left[key] != right[key]:
left[key] = right[key]
else:
left[key] = right[key]
return left
def read_config():
with open('../config.yaml.dist') as handle:
ret = yaml.load(handle.read())
if os.path.exists('../config.yaml'):
with open('../config.yaml') as handle:
ret = merge(ret, yaml.load(handle.read()))
return ret
config = read_config() # pylint: disable=invalid-name
|
© 2015 - 2026 Jakob L. Kreuze