mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-09 06:35:37 +08:00
Fix default value setting for rack attack [SCI-2864]
This commit is contained in:
parent
86aa7e7d53
commit
3277ab1422
2 changed files with 4 additions and 1 deletions
|
@ -9,7 +9,8 @@ Api.configure do |config|
|
|||
config.core_api_token_iss = ENV['CORE_API_TOKEN_ISS']
|
||||
end
|
||||
|
||||
config.core_api_rate_limit = ENV['CORE_API_RATE_LIMIT'].to_i || 1000
|
||||
config.core_api_rate_limit =
|
||||
ENV['CORE_API_RATE_LIMIT'] ? ENV['CORE_API_RATE_LIMIT'].to_i : 1000
|
||||
|
||||
config.core_api_v1_preview = true if ENV['CORE_API_V1_PREVIEW']
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
return unless Rails.env.production?
|
||||
|
||||
return if Api.configuration.core_api_rate_limit.zero?
|
||||
|
||||
Rack::Attack.throttle('api requests by ip',
|
||||
limit: Api.configuration.core_api_rate_limit,
|
||||
period: 60) do |request|
|
||||
|
|
Loading…
Add table
Reference in a new issue