put backk sql preread

This commit is contained in:
Simon 2020-10-03 22:25:30 +01:00
parent e512673eb1
commit 6e4e8907e7

View File

@ -1155,18 +1155,25 @@ if __name__ == '__main__':
logger.debug('(MYSQL) MySQL config enabled') logger.debug('(MYSQL) MySQL config enabled')
SQLCONFIG = {} SQLCONFIG = {}
sql = useMYSQL(CONFIG['MYSQL']['SERVER'], CONFIG['MYSQL']['USER'], CONFIG['MYSQL']['PASS'], CONFIG['MYSQL']['DB'],logger) sql = useMYSQL(CONFIG['MYSQL']['SERVER'], CONFIG['MYSQL']['USER'], CONFIG['MYSQL']['PASS'], CONFIG['MYSQL']['DB'],logger)
#if sql.con(): #Run it once immediately
# logger.debug('(MYSQL) reading config from database') if sql.con():
# try: logger.debug('(MYSQL) reading config from database')
# SQLCONFIG = sql.getConfig() try:
SQLCONFIG = sql.getConfig()
#Add MySQL config data to config dict #Add MySQL config data to config dict
# CONFIG['SYSTEMS'].update(SQLCONFIG) except:
# sql.close() logger.debug('(MYSQL) problem with SQL query, aborting')
# except: sql.close()
# logger.debug('(MYSQL) problem with SQL query, aborting') logger.debug('(MYSQL) building ACLs')
# sql.close() # Registration ACLs
#else: for system in SQLCONFIG:
# logger.debug('(MYSQL) problem connecting to SQL server, aborting') SQLCONFIG[system]['REG_ACL'] = acl_build(SQLCONFIG[system]['REG_ACL'], PEER_MAX)
for acl in ['SUB_ACL', 'TG1_ACL', 'TG2_ACL']:
SQLCONFIG[system][acl] = acl_build(SQLCONFIG[system][acl], ID_MAX)
CONFIG['SYSTEMS'].update(SQLCONFIG)
else:
logger.debug('(MYSQL) problem connecting to SQL server, aborting')
# Set up the signal handler # Set up the signal handler