Commit 5d263a7e authored by Pavel Kuzmenko's avatar Pavel Kuzmenko
Browse files

Merge branch 'kpn/4/param_for_web.TCPSite' into 'master'

fix: #4 tcp_params moved to __init__ to remove conflict with runner_kwargs

Closes #4

See merge request !16
parents eb3a357c 717faa54
......@@ -25,21 +25,22 @@ async def metrics(request):
class AioAppWrapper:
def __init__(self, _app, _port: int, _loop, **kwargs: Any):
def __init__(self, _app, _port: int, _loop, tcp_params=None, **kwargs: Any):
self.app = _app
self.port = _port
self.loop = _loop
self.runner_kwargs = kwargs
self.runner = None
self.tcp_params = {}
if isinstance(tcp_params, dict):
self.tcp_params = tcp_params
async def initialize(self):
LOG.info(f'Initialize web app on port {self.port}')
tcp_params = {}
if isinstance(self.runner_kwargs.get('tcp_params'), dict):
tcp_params = self.runner_kwargs.get('tcp_params', {})
self.runner = web.AppRunner(self.app, **self.runner_kwargs)
await self.runner.setup()
site = web.TCPSite(self.runner, '0.0.0.0', self.port, **tcp_params)
site = web.TCPSite(self.runner, '0.0.0.0', self.port, **self.tcp_params)
await site.start()
while True:
await asyncio.sleep(3600)
......
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