forked from LBRYCommunity/lbry-sdk
Merge pull request #249 from lbryio/settings-bugs
fix --wallet argument bug, use .json conf file if not given a .yml file
This commit is contained in:
commit
5ea945ca0b
2 changed files with 13 additions and 2 deletions
|
@ -267,7 +267,7 @@ class Config(DefaultSettings):
|
|||
return os.path.join(self.ensure_data_dir(), self.LOG_FILE_NAME)
|
||||
|
||||
def get_conf_filename(self):
|
||||
return os.path.join(self.ensure_data_dir(), "daemon_settings.yml")
|
||||
return get_settings_file_ext(self.ensure_data_dir())
|
||||
|
||||
|
||||
def update_settings_from_file(filename=None):
|
||||
|
@ -280,6 +280,17 @@ def update_settings_from_file(filename=None):
|
|||
log.info('%s: Failed to update settings from %s', ex, filename)
|
||||
|
||||
|
||||
def get_settings_file_ext(data_dir):
|
||||
yml_path = os.path.join(data_dir, "daemon_settings.yml")
|
||||
json_path = os.path.join(data_dir, "daemon_settings.json")
|
||||
if os.path.isfile(yml_path):
|
||||
return yml_path
|
||||
elif os.path.isfile(json_path):
|
||||
return json_path
|
||||
else:
|
||||
return yml_path
|
||||
|
||||
|
||||
settings_decoders = {
|
||||
'.json': json.loads,
|
||||
'.yml': yaml.load
|
||||
|
|
|
@ -115,7 +115,7 @@ def update_settings_from_args(args):
|
|||
if args.branch:
|
||||
to_pass['ui_branch'] = args.branch
|
||||
to_pass['use_auth_http'] = args.useauth
|
||||
to_pass['wallet_type'] = args.wallet
|
||||
to_pass['wallet'] = args.wallet
|
||||
settings.update(to_pass)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue