From 639744e047e745b7eeaa92090a54cadceaebc559 Mon Sep 17 00:00:00 2001 From: Antonio Quartulli Date: Mon, 29 Jan 2018 17:16:41 +0800 Subject: [PATCH] conf: initialize IDs after reading config file Installation_id and node_id are stored in the data dir. For this reason they should be read/created only after the config has been parsed. This way they can be retrieved or stored at the right location. Signed-off-by: Antonio Quartulli --- lbrynet/conf.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lbrynet/conf.py b/lbrynet/conf.py index 94b4eb941..cbeaac87f 100644 --- a/lbrynet/conf.py +++ b/lbrynet/conf.py @@ -509,6 +509,10 @@ class Config(object): converted[k] = v return converted + def initialize_post_conf_load(self): + settings.installation_id = settings.get_installation_id() + settings.node_id = settings.get_node_id() + def load_conf_file_settings(self): if conf_file: path = conf_file @@ -528,6 +532,9 @@ class Config(object): except (IOError, OSError) as err: log.info('%s: Failed to update settings from %s', err, path) + #initialize members depending on config file + self.initialize_post_conf_load() + def _fix_old_conf_file_settings(self, settings_dict): if 'API_INTERFACE' in settings_dict: settings_dict['api_host'] = settings_dict['API_INTERFACE'] @@ -628,7 +635,5 @@ def initialize_settings(load_conf_file=True): if settings is None: settings = Config(FIXED_SETTINGS, ADJUSTABLE_SETTINGS, environment=get_default_env()) - settings.installation_id = settings.get_installation_id() - settings.node_id = settings.get_node_id() if load_conf_file: settings.load_conf_file_settings()