faust
faust copied to clipboard
Could you please extend the setting of the webserver to pass parameters?
Checklist
- [X] I have included information about relevant versions
- [X] I have verified that the issue persists when using the
masterbranch of Faust.
Steps to reproduce
I am required to pass some parameters to the aiohttp application directly (e.g. middleware, client_max_size, ...) to extend the worker API. However, it's not possible in the actual implementation of the aiohttp driver.
Could you please extend the setting or the aiohttp driver to overcome this limitation?
Expected behavior
Support for web server parameters
Actual behavior
Not supported
Full traceback
# faust/web/drivers/aiohttp.py
class Web(base.Web):
def __init__(self, app: AppT, **kwargs: Any) -> None:
super().__init__(app, **kwargs)
self.web_app: Application = Application() # <------- EXTEND WITH KWARGS
self.cors_options = _prepare_cors_options(app.conf.web_cors_options or {})
self._runner: AppRunner = AppRunner(self.web_app, access_log=None)
self._transport_handlers = {
"tcp": self._new_transport_tcp,
"unix": self._new_transport_unix,
}
Versions
- Python version: 3.10
- Faust version: 0.10.16
- Operating system: Ubuntu
This is not that easy as we do run all the components as mode.Service instances. The first line in __init__ does exactly this, and the aiohttp.Application kwargs wouldn't be allowed in mode.Service.
What we could do though is to allow web_driver_args params in creation that could then be thrown into this.