def run(self):
wsgi_app_https = ReverseProxied(ProxyFix(wsgi.WSGIPathInfoDispatcher({'/': app})))
wsgi_app_http = ReverseProxied(ProxyFix(wsgi.WSGIPathInfoDispatcher({'/': adapter_app})))
cherrypy.server.unsubscribe()
cherrypy.config.update({'environment': 'production'})
bind_addr = (self.config['listen'], self.config['port'])
server_https = wsgi.WSGIServer(bind_addr=bind_addr,
wsgi_app=wsgi_app_https)
server_https.ssl_adapter = http_helpers.ssl_adapter(self.config['certificate'],
self.config['private_key'])
ServerAdapter(cherrypy.engine, server_https).subscribe()
logger.debug('WSGIServer starting... uid: %s, listen: %s:%s',
os.getuid(), bind_addr[0], bind_addr[1])
for route in http_helpers.list_routes(app):
logger.debug(route)
if self.adapter_config['enabled']:
bind_addr = (self.adapter_config['listen'], self.adapter_config['port'])
server_adapter = wsgi.WSGIServer(bind_addr=bind_addr,
wsgi_app=wsgi_app_http)
ServerAdapter(cherrypy.engine, server_adapter).subscribe()
logger.debug('WSGIServer starting... uid: %s, listen: %s:%s',
os.getuid(), bind_addr[0], bind_addr[1])
for route in http_helpers.list_routes(adapter_app):
logger.debug(route)
else:
logger.debug('Adapter server is disabled')
try:
cherrypy.engine.start()
cherrypy.engine.wait(states.EXITING)
except KeyboardInterrupt:
logger.warning('Stopping xivo-ctid-ng: KeyboardInterrupt')
cherrypy.engine.exit()
评论列表
文章目录