Commit d5ae215f authored by vadym.tishchenko's avatar vadym.tishchenko
Browse files

Add kwargs to the AppRunner

parent 4d7db971
......@@ -21,16 +21,17 @@ async def metrics(request):
class AioAppWrapper:
def __init__(self, _app, _port, _loop):
def __init__(self, _app, _port, _loop, **kwargs):
self.app = _app
self.port = _port
self.loop = _loop
self.runner = None
self.kwargs = kwargs
def initialize(self):
LOG.info(f'Initialize web app on port {self.port}')
self.runner = web.AppRunner(self.app)
self.runner = web.AppRunner(self.app, **self.kwargs)
self.loop.run_until_complete(self.runner.setup())
site = web.TCPSite(self.runner, '0.0.0.0', self.port)
return site.start()
......@@ -72,10 +73,10 @@ class ApplicationWrapper:
self.add_web_app(init_mertics_app(), _port=9091)
def add_web_app(self, _app, _port):
def add_web_app(self, _app, _port, **kwargs):
_app._set_loop(self.loop)
self.apps.append(
AioAppWrapper(_app, _port, self.loop)
AioAppWrapper(_app, _port, self.loop, **kwargs)
)
def add_coroutine(self, _coro, _stop_callback=None):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment