fix: fixed config merge with user config exists but it's empty
This commit is contained in:
parent
4f694ddb83
commit
72e6668c17
@ -20,13 +20,15 @@ def merge_config(user, default):
|
|||||||
|
|
||||||
|
|
||||||
def load_config(args):
|
def load_config(args):
|
||||||
with open(args.config, 'rt') as fp:
|
with open(args.config) as fp:
|
||||||
config = yaml.safe_load(fp)
|
config = yaml.safe_load(fp)
|
||||||
|
|
||||||
if os.path.exists(args.user_config):
|
if os.path.exists(args.user_config):
|
||||||
with open(args.user_config, 'rt') as fp:
|
with open(args.user_config) as fp:
|
||||||
user_config = yaml.safe_load(fp)
|
user_config = yaml.safe_load(fp)
|
||||||
config = merge_config(user_config, config)
|
# if the file is empty, safe_load will return None and merge_config will boom.
|
||||||
|
if user_config:
|
||||||
|
config = merge_config(user_config, config)
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user