def refreshConfig(self, do_reload=False): conf = self.glo.getConfig() if do_reload is True: # in case there is no entry in the dbconf or # the config file is newer, we write the config back to the db entries = list(conf.keys()) for entry in entries: del conf[entry] writeback = False # get all conf entries from the config file fileconf = current_app.config # get all configs from the DB (dbconf, delay) = _retrieveAllConfigDB() self.glo.setConfigIncomplete(not delay) # we only merge the config file once as a removed entry # might reappear otherwise if 'linotp.Config' not in dbconf: conf.update(fileconf) writeback = True conf.update(dbconf) if writeback is True: for con in conf: _storeConfigDB(con, conf.get(con)) _storeConfigDB('linotp.Config', datetime.now()) self.glo.setConfig(conf, replace=True) super().update(conf) return
def refresh_config(): """ retrieves all config entries from the database and rewrites the global linotp_config object """ global linotp_config linotp_config, delay = _retrieveAllConfigDB()
def refresh_config(): """ retrieves all config entries from the database and rewrites the global linotp_config object """ global linotp_config linotp_config, delay = _retrieveAllConfigDB()
def refreshConfig(self, do_reload=False): conf = self.glo.getConfig() if do_reload is True: # in case there is no entry in the dbconf or # the config file is newer, we write the config back to the db entries = conf.keys() for entry in entries: del conf[entry] writeback = False # get all conf entries from the config file fileconf = _getConfigFromEnv() # get all configs from the DB (dbconf, delay) = _retrieveAllConfigDB() self.glo.setConfigIncomplete(not delay) # we only merge the config file once as a removed entry # might reappear otherwise if 'linotp.Config' not in dbconf: conf.update(fileconf) writeback = True conf.update(dbconf) # check, if there is a selfTest in the DB and delete it if 'linotp.selfTest' in dbconf: _removeConfigDB('linotp.selfTest') _storeConfigDB('linotp.Config', datetime.now()) # the only thing we take from the fileconf is the selftest if 'linotp.selfTest' in fileconf: conf['linotp.selfTest'] = 'True' if writeback is True: for con in conf: if con != 'linotp.selfTest': _storeConfigDB(con, conf.get(con)) _storeConfigDB('linotp.Config', datetime.now()) self.glo.setConfig(conf, replace=True) self.parent.update(conf) return
def refreshConfig(self, do_reload=False): conf = self.glo.getConfig() if do_reload is True: # in case there is no entry in the dbconf or # the config file is newer, we write the config back to the db entries = conf.keys() for entry in entries: del conf[entry] writeback = False # get all conf entries from the config file fileconf = _getConfigFromEnv() # get all configs from the DB (dbconf, delay) = _retrieveAllConfigDB() self.glo.setConfigIncomplete(not delay) # we only merge the config file once as a removed entry # might reappear otherwise if 'linotp.Config' not in dbconf: conf.update(fileconf) writeback = True conf.update(dbconf) # check, if there is a selfTest in the DB and delete it if 'linotp.selfTest' in dbconf: _removeConfigDB('linotp.selfTest') _storeConfigDB('linotp.Config', datetime.now()) # the only thing we take from the fileconf is the selftest if 'linotp.selfTest' in fileconf: conf['linotp.selfTest'] = 'True' if writeback is True: for con in conf: if con != 'linotp.selfTest': _storeConfigDB(con, conf.get(con)) _storeConfigDB(u'linotp.Config', datetime.now()) self.glo.setConfig(conf, replace=True) self.parent.update(conf) return
def refreshConfig(self, do_reload=False): conf = self.glo.getConfig() if do_reload is True: # in case there is no entry in the dbconf or # the config file is newer, we write the config back to the db entries = list(conf.keys()) for entry in entries: del conf[entry] # get all configs from the DB (dbconf, delay) = _retrieveAllConfigDB() self.glo.setConfigIncomplete(not delay) conf.update(dbconf) self.glo.setConfig(conf, replace=True) super().update(conf) return