From 56331b3de25d348442954dbe3bdb1bd4c9fff694 Mon Sep 17 00:00:00 2001 From: David Reed Date: Thu, 21 Sep 2023 23:52:03 +0000 Subject: [PATCH] Enable DRF API throttling --- config/settings/base.py | 9 +++++++++ metadeploy/api/management/commands/populate_data.py | 1 + 2 files changed, 10 insertions(+) diff --git a/config/settings/base.py b/config/settings/base.py index 920d984e44..576b3c9790 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -454,6 +454,15 @@ def safe_key() -> str: "rest_framework.authentication.TokenAuthentication", "rest_framework.authentication.SessionAuthentication", ), + 'DEFAULT_THROTTLE_CLASSES': [ + 'rest_framework.throttling.AnonRateThrottle', + 'rest_framework.throttling.UserRateThrottle' + ], + 'DEFAULT_THROTTLE_RATES': { + 'anon': '4/sec', + 'user': '4/sec' + } + } # Token expiration diff --git a/metadeploy/api/management/commands/populate_data.py b/metadeploy/api/management/commands/populate_data.py index c74a34753b..fff9b18933 100644 --- a/metadeploy/api/management/commands/populate_data.py +++ b/metadeploy/api/management/commands/populate_data.py @@ -281,6 +281,7 @@ def create_eda(self, category): title="Install", tier=Plan.Tier.primary, commit_ish="e785195d07a3ac9e395f27829866005dbdcd5bd0", + supported_orgs="Both" ) PlanSlug.objects.create(parent=plan_template, slug="install") steps = [