コード例 #1
0
ファイル: __init__.py プロジェクト: josephlewis42/magpie
	def update_config(self, *args):
		'''Called when the configuration for the plugin has been updated from
		another source.
		'''
		AbstractPlugin.update_config(self, *args)
		print("http2 updating config {}".format(self._config))
		try:
			shutdown_server()
		except RuntimeError:
			pass # not running yet.
		
		self._logger.info("Starting HTTP2 Server on Port: http://{host}:{port}".format(**self._config))
		background_thread = threading.Thread(target=app.run, kwargs={'host':self._config['host'], 'port':self._config['port'], 'threaded':True})
		background_thread.daemon = True
		background_thread.start()
コード例 #2
0
ファイル: hypertext.py プロジェクト: josephlewis42/magpie
	def update_config(self, *args):
		'''Called when the configuration for the plugin has been updated from
		another source.
		'''
		AbstractPlugin.update_config(self, *args)

		if not self._config['enabled']:
			if self._http_server != None:
				self._http_server.shutdown()
			return
		
		self._logger.info("Starting HTTP Server on Port: http://{host}:{port}".format(**self._config))
		background_thread = threading.Thread(target=self._start_web_server)
		background_thread.daemon = True
		background_thread.start()
		
		self._logger.info("Server online and active")