From 85608531cc8dc34b4509cc3ad88001f1b8c27760 Mon Sep 17 00:00:00 2001 From: Tushar Goel Date: Tue, 21 Mar 2023 16:45:23 +0530 Subject: [PATCH] Address review comments Signed-off-by: Tushar Goel --- docs/source/misc.rst | 14 +++++++------- vulnerablecode/settings.py | 22 +++++++++++++++------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/docs/source/misc.rst b/docs/source/misc.rst index 5553739bb..c2aab16a9 100644 --- a/docs/source/misc.rst +++ b/docs/source/misc.rst @@ -56,10 +56,10 @@ The default throttling settings are defined in ``settings.py``. To override the default settings, add env variables in ``.env`` file define the settings there. For example:: - ALL_VULNERABLE_PACKAGES_THROTTLING_RATE = '1000/hour' - BULK_SEARCH_PACKAGE_THROTTLING_RATE = '10/minute' - PACKAGES_SEARCH_THROTTLING_RATE = '1000/second' - VULNERABILITIES_SEARCH_THROTTLING_RATE = '1000/hour' - ALIASES_SEARCH_THROTTLING_RATE = '1000/hour' - CPE_SEARCH_THROTTLING_RATE = '10/minute' - BULK_SEARCH_CPE_THROTTLING_RATE = '10/minute' + VULNERABLECODE_ALL_VULNERABLE_PACKAGES_THROTTLING_RATE = '1000/hour' + VULNERABLECODE_BULK_SEARCH_PACKAGE_THROTTLING_RATE = '10/minute' + VULNERABLECODE_PACKAGES_SEARCH_THROTTLING_RATE = '1000/second' + VULNERABLECODE_VULNERABILITIES_SEARCH_THROTTLING_RATE = '1000/hour' + VULNERABLECODE_ALIASES_SEARCH_THROTTLING_RATE = '1000/hour' + VULNERABLECODE_CPE_SEARCH_THROTTLING_RATE = '10/minute' + VULNERABLECODE_BULK_SEARCH_CPE_THROTTLING_RATE = '10/minute' diff --git a/vulnerablecode/settings.py b/vulnerablecode/settings.py index 908358024..3187b67ec 100644 --- a/vulnerablecode/settings.py +++ b/vulnerablecode/settings.py @@ -172,13 +172,21 @@ LOGOUT_REDIRECT_URL = "/" REST_FRAMEWORK_DEFAULT_THROTTLE_RATES = { - "vulnerable_packages": env.str("ALL_VULNERABLE_PACKAGES_THROTTLING_RATE", default="1/hour"), - "bulk_search_packages": env.str("BULK_SEARCH_PACKAGE_THROTTLING_RATE", default="5/hour"), - "packages": env.str("PACKAGES_SEARCH_THROTTLING_RATE", default="10/minute"), - "vulnerabilities": env.str("VULNERABILITIES_SEARCH_THROTTLING_RATE", default="10/minute"), - "aliases": env.str("ALIASES_SEARCH_THROTTLING_RATE", default="5/minute"), - "cpes": env.str("CPE_SEARCH_THROTTLING_RATE", default="5/minute"), - "bulk_search_cpes": env.str("BULK_SEARCH_CPE_THROTTLING_RATE", default="5/minute"), + "vulnerable_packages": env.str( + "VULNERABLECODE_ALL_VULNERABLE_PACKAGES_THROTTLING_RATE", default="1/hour" + ), + "bulk_search_packages": env.str( + "VULNERABLECODE_BULK_SEARCH_PACKAGE_THROTTLING_RATE", default="5/hour" + ), + "packages": env.str("VULNERABLECODE_PACKAGES_SEARCH_THROTTLING_RATE", default="10/minute"), + "vulnerabilities": env.str( + "VULNERABLECODE_VULNERABILITIES_SEARCH_THROTTLING_RATE", default="10/minute" + ), + "aliases": env.str("VULNERABLECODE_ALIASES_SEARCH_THROTTLING_RATE", default="5/minute"), + "cpes": env.str("VULNERABLECODE_CPE_SEARCH_THROTTLING_RATE", default="5/minute"), + "bulk_search_cpes": env.str( + "VULNERABLECODE_BULK_SEARCH_CPE_THROTTLING_RATE", default="5/minute" + ), } if IS_TESTS: