File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
templates/onadata_checkout_path/onadata/preset Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -326,3 +326,8 @@ onadata_crf_cookie_secure: True
326
326
onadata_crf_use_sessions : True
327
327
onadata_session_cookie_secure : True
328
328
onadata_session_cookie_samesite : " Strict"
329
+
330
+ # throttling
331
+ onadata_enable_requests_throttling : False
332
+ onadata_throttling_rate : 50
333
+ onadata_throttling_user_agents : []
Original file line number Diff line number Diff line change @@ -90,7 +90,27 @@ REST_FRAMEWORK = {
90
90
'rest_framework.renderers.BrowsableAPIRenderer',
91
91
'rest_framework_csv.renderers.CSVRenderer',
92
92
),
93
+ {% if onadata_enable_requests_throttling |default (false ) %}
94
+ 'DEFAULT_THROTTLE_CLASSES': (
95
+ 'onadata.libs.throttle.RequestHeaderThrottle',
96
+ ),
97
+ 'DEFAULT_THROTTLE_RATES': {
98
+ 'header': '{{ onadata_throttling_rate }}/minute'
99
+ }
100
+ {% endif %}
93
101
}
102
+ {% if onadata_enable_requests_throttling |default (false ) %}
103
+ THROTTLE_HEADERS = {
104
+ "HTTP_USER_AGENT": [
105
+ {% for user_agent in onadata_throttling_user_agents %}
106
+ '{{ user_agent }}',
107
+ {% endfor %}
108
+ ],
109
+ {% if onadata_throttling_remote_user is defined %}
110
+ "REMOTE_USER": '{{ onadata_throttling_remote_user }}'
111
+ {% endif %}
112
+ }
113
+ {% endif %}
94
114
OAUTH2_PROVIDER['AUTHORIZATION_CODE_EXPIRE_SECONDS'] = 600
95
115
OAUTH2_PROVIDER['PKCE_REQUIRED'] = {{ onadata_oauth2_pkce_required }}
96
116
BROKER_TRANSPORT = 'librabbitmq'
You can’t perform that action at this time.
0 commit comments