From 297865902b1b14b712355e1cd01783e0788c5cce Mon Sep 17 00:00:00 2001 From: Jack Date: Sat, 5 Nov 2016 14:23:48 -0400 Subject: [PATCH] use json conf file if not given yml --- lbrynet/conf.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lbrynet/conf.py b/lbrynet/conf.py index 807f3cb0e..c69b640f8 100644 --- a/lbrynet/conf.py +++ b/lbrynet/conf.py @@ -266,7 +266,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): @@ -279,6 +279,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