Skip to content

Commit

Permalink
馃挌 Add setting to disable rate limiter
Browse files Browse the repository at this point in the history
Not exposed on the UI and never will be, but allows
us to disable rate limiting on the API for easier
E2E testing.
  • Loading branch information
foosel committed Sep 1, 2022
1 parent 3cca3a4 commit b83b574
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/fixtures/with_acl/config.yaml
@@ -1,5 +1,7 @@
accessControl:
salt: zXmvzI3uWuTLkSPOEfA2ZLwn3f3sGUNS
devel:
enableRateLimiter: false
plugins:
virtual_printer:
enabled: true
Expand Down
6 changes: 5 additions & 1 deletion src/octoprint/server/__init__.py
Expand Up @@ -1452,7 +1452,11 @@ def after_request(response):

app.config["RATELIMIT_STRATEGY"] = "fixed-window-elastic-expiry"

limiter = Limiter(app, key_func=get_remote_address)
limiter = Limiter(
app,
key_func=get_remote_address,
enabled=s.getBoolean(["devel", "enableRateLimiter"]),
)

def _setup_i18n(self, app):
global babel
Expand Down
1 change: 1 addition & 0 deletions src/octoprint/settings.py
Expand Up @@ -471,6 +471,7 @@ def settings(init=False, basedir=None, configfile=None, overlays=None):
"showLoadingAnimation": True,
"sockJsConnectTimeout": 30,
"pluginTimings": False,
"enableRateLimiter": True,
},
}
"""The default settings of the core application."""
Expand Down

0 comments on commit b83b574

Please sign in to comment.