Skip to content

[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

  1. Rename attributes for unauthenticated rate limit: !69543 (merged)
  2. Add columns for unauthenticated API rate limit: 👈 This MR
  3. Apply unauthenticated API rate limit in Rack Attack configuration: !69388 (merged)
  4. Update settings form in admin area: !69486 (merged)
  5. 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

Availability and Testing

Related to #335300 (closed)

Edited by Markus Koller

Merge request reports