Commit 8eab376a authored by Benjamin "Ziirish" SANS's avatar Benjamin "Ziirish" SANS
Browse files

fix: limiter was not applied on all routes

parent 12818da8
......@@ -467,7 +467,7 @@ def create_app(conf=None, verbose=0, logfile=None, **kwargs):
cache.init_app(app)
try:
# Limiter setup
if not app.limiter or str(app.limiter).lower() not \
if app.limiter or str(app.limiter).lower() not \
in ['none', 'false']: # pragma: no cover
from .ext.limit import limiter
app.config['RATELIMIT_HEADERS_ENABLED'] = True
......@@ -509,17 +509,6 @@ def create_app(conf=None, verbose=0, logfile=None, **kwargs):
else:
cache.init_app(app)
# Create celery app if enabled
create_celery(app, warn=False)
if app.config['WITH_CELERY']:
# may fail in case redis is not running (this can happen while running
# the bui-manage script)
try:
from .api.async import force_scheduling_now
force_scheduling_now()
except: # pragma: no cover
pass
# Initialize i18n
babel.init_app(app)
......@@ -567,6 +556,17 @@ def create_app(conf=None, verbose=0, logfile=None, **kwargs):
bower = Bower()
bower.init_app(app)
# Create celery app if enabled
create_celery(app, warn=False)
if app.config['WITH_CELERY']:
# may fail in case redis is not running (this can happen while running
# the bui-manage script)
try:
from .api.async import force_scheduling_now
force_scheduling_now()
except: # pragma: no cover
pass
def _check_session(user, request, api=False):
"""Check if the session is in the db"""
if user and not session_manager.session_in_db(): # pragma: no cover
......
......@@ -301,6 +301,7 @@ class BUIServer(Flask):
self.logger.info('auth: {}'.format(self.auth))
self.logger.info('celery: {}'.format(self.use_celery))
self.logger.info('redis: {}'.format(self.redis))
self.logger.info('limiter: {}'.format(self.limiter))
self.logger.info('database: {}'.format(self.database))
self.logger.info('with SQL: {}'.format(self.config['WITH_SQL']))
self.logger.info('with Celery: {}'.format(self.config['WITH_CELERY']))
......
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