def run(self): if self.config['profile']: app.wsgi_app = ProfilerMiddleware( app.wsgi_app, profile_dir=self.config['profile']) wsgi_app = ReverseProxied( ProxyFix(wsgi.WSGIPathInfoDispatcher({'/': app}))) bind_addr = (self.config['listen'], self.config['port']) self.server = wsgi.WSGIServer(bind_addr=bind_addr, wsgi_app=wsgi_app) self.server.ssl_adapter = http_helpers.ssl_adapter( self.config['certificate'], self.config['private_key']) 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) try: self.server.start() except KeyboardInterrupt: logger.warning('Stopping wazo-confd: KeyboardInterrupt') self.server.stop()
def run(self): bind_addr = (self.config['listen'], self.config['port']) wsgi_app = ReverseProxied( ProxyFix(wsgi.WSGIPathInfoDispatcher({'/': app}))) self.server = wsgi.WSGIServer(bind_addr=bind_addr, wsgi_app=wsgi_app) if self.config['certificate'] and self.config['private_key']: logger.warning( 'Using service SSL configuration is deprecated. Please use NGINX instead.' ) self.server.ssl_adapter = http_helpers.ssl_adapter( self.config['certificate'], self.config['private_key']) 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) try: self.server.start() except KeyboardInterrupt: self.server.stop()
def __init__(self, config, root_worker): self._executor = ThreadPoolExecutor( max_workers=10) # Make it configurable self._xivo_uuid = config.get('uuid') self._listen_addr = config['rest_api']['https']['listen'] self._listen_port = config['rest_api']['https']['port'] self._cors_config = config['rest_api']['cors'] self._ssl_cert_file = config['rest_api']['https']['certificate'] ssl_key_file = config['rest_api']['https']['private_key'] self._consul_config = config['consul'] self._service_discovery_config = config['service_discovery'] self._bus_config = config['bus'] bind_addr = (self._listen_addr, self._listen_port) self._publisher = bus.StatusPublisher.from_config(config) plugin_service = service.PluginService.from_config( config, self._publisher, root_worker, self._executor) flask_app = http.new_app(config, plugin_service=plugin_service) flask_app.after_request(http_helpers.log_request) wsgi.WSGIServer.ssl_adapter = http_helpers.ssl_adapter( self._ssl_cert_file, ssl_key_file) wsgi_app = ReverseProxied( ProxyFix(wsgi.WSGIPathInfoDispatcher({'/': flask_app}))) self._server = wsgi.WSGIServer(bind_addr=bind_addr, wsgi_app=wsgi_app) for route in http_helpers.list_routes(flask_app): logger.debug(route)
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()
def run(self): config = self._config['https'] bind_addr = (config['listen'], config['port']) wsgi_app = ReverseProxied(ProxyFix(self._app)) server = wsgi.WSGIServer(bind_addr, wsgi_app) server.ssl_adapter = http_helpers.ssl_adapter(config['certificate'], config['private_key']) try: server.start() finally: server.stop()
def run(self): bind_addr = (self._config['listen'], self._config['port']) wsgi_app = ReverseProxied(ProxyFix(self._app)) server = wsgi.WSGIServer(bind_addr, wsgi_app) if self._config['certificate'] and self._config['private_key']: logger.warning( 'Using service SSL configuration is deprecated. Please use NGINX instead.' ) server.ssl_adapter = http_helpers.ssl_adapter( self._config['certificate'], self._config['private_key']) try: server.start() finally: server.stop()
def run(self): bind_addr = (self.config['listen'], self.config['port']) wsgi_app = ReverseProxied(ProxyFix(wsgi.WSGIPathInfoDispatcher({'/': app}))) self.server = wsgi.WSGIServer(bind_addr=bind_addr, wsgi_app=wsgi_app) self.server.ssl_adapter = http_helpers.ssl_adapter(self.config['certificate'], self.config['private_key']) 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) try: self.server.start() except KeyboardInterrupt: self.server.stop()
def run(self): self.api.init_app(self.app) https_config = self.config['https'] bind_addr = (https_config['listen'], https_config['port']) wsgi_app = ReverseProxied( ProxyFix(wsgi.WSGIPathInfoDispatcher({'/': self.app}))) server = wsgi.WSGIServer(bind_addr=bind_addr, wsgi_app=wsgi_app) server.ssl_adapter = http_helpers.ssl_adapter( https_config['certificate'], https_config['private_key']) logger.debug('WSGIServer starting... uid: %s, listen: %s:%s', os.getuid(), bind_addr[0], bind_addr[1]) for route in http_helpers.list_routes(self.app): logger.debug(route) try: server.start() finally: server.stop()