forked from LBRYCommunity/lbry-sdk
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 <antonio@mandelbit.com>
This commit is contained in:
parent
34976c7602
commit
639744e047
1 changed files with 7 additions and 2 deletions
|
@ -509,6 +509,10 @@ class Config(object):
|
||||||
converted[k] = v
|
converted[k] = v
|
||||||
return converted
|
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):
|
def load_conf_file_settings(self):
|
||||||
if conf_file:
|
if conf_file:
|
||||||
path = conf_file
|
path = conf_file
|
||||||
|
@ -528,6 +532,9 @@ class Config(object):
|
||||||
except (IOError, OSError) as err:
|
except (IOError, OSError) as err:
|
||||||
log.info('%s: Failed to update settings from %s', err, path)
|
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):
|
def _fix_old_conf_file_settings(self, settings_dict):
|
||||||
if 'API_INTERFACE' in settings_dict:
|
if 'API_INTERFACE' in settings_dict:
|
||||||
settings_dict['api_host'] = settings_dict['API_INTERFACE']
|
settings_dict['api_host'] = settings_dict['API_INTERFACE']
|
||||||
|
@ -628,7 +635,5 @@ def initialize_settings(load_conf_file=True):
|
||||||
if settings is None:
|
if settings is None:
|
||||||
settings = Config(FIXED_SETTINGS, ADJUSTABLE_SETTINGS,
|
settings = Config(FIXED_SETTINGS, ADJUSTABLE_SETTINGS,
|
||||||
environment=get_default_env())
|
environment=get_default_env())
|
||||||
settings.installation_id = settings.get_installation_id()
|
|
||||||
settings.node_id = settings.get_node_id()
|
|
||||||
if load_conf_file:
|
if load_conf_file:
|
||||||
settings.load_conf_file_settings()
|
settings.load_conf_file_settings()
|
||||||
|
|
Loading…
Add table
Reference in a new issue