Merge pull request #209 from abf/rosa-build:192-disable-api-defender-for-our-servers

#192: disable api defender for our servers
This commit is contained in:
avm 2013-07-04 16:19:51 +04:00
commit d7ddf34c98
2 changed files with 5 additions and 1 deletions

View File

@ -5,6 +5,8 @@ common: &common
preregistration: false
file_store_url: 'http://file-store.rosalinux.ru'
distr_types: ['mdv', 'rhel', 'nau5']
allowed_addresses:
- 127.0.0.1
abf_worker:
publish_workers_count: 2
keys:

View File

@ -51,7 +51,9 @@ class ApiDefender < Rack::Throttle::Hourly
# only API calls should be throttled
def need_defense?(request)
request.env['PATH_INFO'] =~ /^\/api\/v1\// && !system_user?(request)
APP_CONFIG['allowed_addresses'].exclude?(request.ip) &&
request.env['PATH_INFO'] =~ /^\/api\/v1\// &&
!system_user?(request)
end
def authorized?(request)