Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def core_bootstrap(configfile=None):
"""
Bootstrap the core machinery without MQTT
"""
# Load configuration file
config = load_configuration(configfile)
# Bootstrap mqttwarn.core
bootstrap(config=config, scriptname='testdrive')
# Load services
services = config.getlist('defaults', 'launch')
load_services(services)
# Launch worker threads to operate on queue
start_workers()
scriptname = os.path.splitext(os.path.basename(sys.argv[0]))[0]
# Load configuration file
config = load_configuration(name=scriptname)
# Setup logging
setup_logging(config)
logger.info("Starting {}".format(scriptname))
logger.info("Log level is %s" % logging.getLevelName(logger.getEffectiveLevel()))
# Handle signals
signal.signal(signal.SIGTERM, cleanup)
signal.signal(signal.SIGINT, cleanup)
# Bootstrap mqttwarn.core
bootstrap(config=config, scriptname=scriptname)
# Connect to broker and start listening
connect()