[2/5] Add `throttle_unauthenticated_api_*` columns to application settings
What does this MR do?
This adds new columns for the rate limit settings for unauthenticated API requests.
The new settings aren't used yet, this will be added in future MRs along with the changes to the UI and docs.
Issue: #335300 (closed)
Roadmap
- Rename attributes for unauthenticated rate limit: !69543 (merged)
-
Add columns for unauthenticated API rate limit:
👈 This MR - Apply unauthenticated API rate limit in Rack Attack configuration: !69388 (merged)
- Update settings form in admin area: !69486 (merged)
- Documentation update: !69487 (merged)
Migration output
Up
$ rails db:migrate:up VERSION=20210826170902
== 20210826170902 AddThrottleUnauthenticatedApiColumns: migrating =============
-- add_column(:application_settings, :throttle_unauthenticated_api_enabled, :boolean, {:default=>false, :null=>false})
-> 0.0038s
-- add_column(:application_settings, :throttle_unauthenticated_api_requests_per_period, :integer, {:default=>3600, :null=>false})
-> 0.0016s
-- add_column(:application_settings, :throttle_unauthenticated_api_period_in_seconds, :integer, {:default=>3600, :null=>false})
-> 0.0017s
== 20210826170902 AddThrottleUnauthenticatedApiColumns: migrated (0.0073s) ====
$ rails db:migrate:up VERSION=20210826171758
== 20210826171758 InitializeThrottleUnauthenticatedApiColumns: migrating ======
== 20210826171758 InitializeThrottleUnauthenticatedApiColumns: migrated (0.0152s)
Down
$ rails db:migrate:down VERSION=20210826171758
== 20210826171758 InitializeThrottleUnauthenticatedApiColumns: reverting ======
== 20210826171758 InitializeThrottleUnauthenticatedApiColumns: reverted (0.0000s)
$ rails db:migrate:down VERSION=20210826170902
== 20210826170902 AddThrottleUnauthenticatedApiColumns: reverting =============
-- remove_column(:application_settings, :throttle_unauthenticated_api_period_in_seconds, :integer, {:default=>3600, :null=>false})
-> 0.0035s
-- remove_column(:application_settings, :throttle_unauthenticated_api_requests_per_period, :integer, {:default=>3600, :null=>false})
-> 0.0018s
-- remove_column(:application_settings, :throttle_unauthenticated_api_enabled, :boolean, {:default=>false, :null=>false})
-> 0.0013s
== 20210826170902 AddThrottleUnauthenticatedApiColumns: reverted (0.0091s) ====
Does this MR meet the acceptance criteria?
Conformity
-
I have included changelog trailers, or none are needed. (Does this MR need a changelog?) - [-] I have added/updated documentation, or it's not needed. (Is documentation required?)
- [-] I have properly separated EE content from FOSS, or this MR is FOSS only. (Where should EE code go?)
-
I have added information for database reviewers in the MR description, or it's not needed. (Does this MR have database related changes?) -
I have self-reviewed this MR per code review guidelines. -
This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) -
I have followed the style guides. -
This change is backwards compatible across updates, or this does not apply.
Availability and Testing
-
I have added/updated tests following the Testing Guide, or it's not needed. (Consider all test levels. See the Test Planning Process.) - [-] I have tested this MR in all supported browsers, or it's not needed.
- [-] I have informed the Infrastructure department of a default or new setting change per definition of done, or it's not needed.
Related to #335300 (closed)
Edited by Markus Koller