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

feat: make content size limit configurable from app config #134

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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: 7 additions & 0 deletions src/zsl/application/service_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

from zsl._state import set_current_app
from zsl.application.initialization_context import InitializationContext
from zsl.task import app
from zsl.utils.warnings import deprecated
from zsl.version import version

Expand Down Expand Up @@ -137,6 +138,8 @@ def _configure(self, config_object=None):
if zsl_settings is not None:
self.config.from_envvar(SETTINGS_ENV_VAR_NAME)

self._configure_flask_app()

def _initialize(self):
"""Run the initializers."""
ctx = self.injector.get(InitializationContext)
Expand Down Expand Up @@ -179,6 +182,10 @@ def _configure_injector(self, modules):
self.logger.debug("Injector configuration with modules {0}.".format(modules))
self._dependencies_initialized = True

def _configure_flask_app(self):
if 'HTTP_REQUEST_MAX_CONTENT_LENGTH' in self.config:
app.config['HTTP_REQUEST_MAX_CONTENT_LENGTH'] = self.config['HTTP_REQUEST_MAX_CONTENT_LENGTH']

@deprecated
def get_initialization_context(self):
return self.injector.get(InitializationContext)
Expand Down