Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added server_args to AbstractApp #1173

Merged
merged 4 commits into from
Apr 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions connexion/apps/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion connexion/apps/aiohttp_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion connexion/apps/flask_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down