diff --git a/connexion/apps/abstract.py b/connexion/apps/abstract.py index 5c9fe301b..bc78e02d5 100644 --- a/connexion/apps/abstract.py +++ b/connexion/apps/abstract.py @@ -10,7 +10,7 @@ class AbstractApp(metaclass=abc.ABCMeta): def __init__(self, import_name, api_cls, port=None, specification_dir='', - host=None, server=None, arguments=None, auth_all_paths=False, debug=None, + host=None, server=None, server_args=None, arguments=None, auth_all_paths=False, debug=None, resolver=None, options=None, skip_error_handlers=False): """ :param import_name: the name of the application package @@ -23,6 +23,8 @@ def __init__(self, import_name, api_cls, port=None, specification_dir='', :type specification_dir: pathlib.Path | str :param server: which wsgi server to use :type server: str | None + :param server_args: dictionary of arguments which are then passed to appropriate http server (Flask or aio_http) + :type server_args: dict | None :param arguments: arguments to replace on the specification :type arguments: dict | None :param auth_all_paths: whether to authenticate not defined paths @@ -45,8 +47,9 @@ def __init__(self, import_name, api_cls, port=None, specification_dir='', self.options = ConnexionOptions(options) - self.app = self.create_app() self.server = server + self.server_args = dict() if server_args is None else server_args + self.app = self.create_app() # we get our application root path to avoid duplicating logic self.root_path = self.get_root_path() diff --git a/connexion/apps/aiohttp_app.py b/connexion/apps/aiohttp_app.py index 581fe6f78..1e3dba8bf 100644 --- a/connexion/apps/aiohttp_app.py +++ b/connexion/apps/aiohttp_app.py @@ -20,7 +20,7 @@ def __init__(self, import_name, only_one_api=False, **kwargs): self._api_added = False def create_app(self): - return web.Application() + return web.Application(**self.server_args) def get_root_path(self): mod = sys.modules.get(self.import_name) diff --git a/connexion/apps/flask_app.py b/connexion/apps/flask_app.py index 41585a7fe..2ae02e132 100644 --- a/connexion/apps/flask_app.py +++ b/connexion/apps/flask_app.py @@ -21,7 +21,7 @@ def __init__(self, import_name, server='flask', **kwargs): super(FlaskApp, self).__init__(import_name, FlaskApi, server=server, **kwargs) def create_app(self): - app = flask.Flask(self.import_name) + app = flask.Flask(self.import_name, **self.server_args) app.json_encoder = FlaskJSONEncoder return app