mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
FIX: ruby bench not working properly
- Remove thin which is no longer supported - Bypass admin api rate limiting in profile environment - Admin password was too short - Run by default in concurrency 1 mode - A skip bundle assets flag to speed up local testing
This commit is contained in:
@ -5,14 +5,14 @@ require_dependency "rate_limiter"
|
||||
|
||||
class Auth::DefaultCurrentUserProvider
|
||||
|
||||
CURRENT_USER_KEY ||= "_DISCOURSE_CURRENT_USER".freeze
|
||||
API_KEY ||= "api_key".freeze
|
||||
USER_API_KEY ||= "HTTP_USER_API_KEY".freeze
|
||||
USER_API_CLIENT_ID ||= "HTTP_USER_API_CLIENT_ID".freeze
|
||||
API_KEY_ENV ||= "_DISCOURSE_API".freeze
|
||||
USER_API_KEY_ENV ||= "_DISCOURSE_USER_API".freeze
|
||||
TOKEN_COOKIE ||= "_t".freeze
|
||||
PATH_INFO ||= "PATH_INFO".freeze
|
||||
CURRENT_USER_KEY ||= "_DISCOURSE_CURRENT_USER"
|
||||
API_KEY ||= "api_key"
|
||||
USER_API_KEY ||= "HTTP_USER_API_KEY"
|
||||
USER_API_CLIENT_ID ||= "HTTP_USER_API_CLIENT_ID"
|
||||
API_KEY_ENV ||= "_DISCOURSE_API"
|
||||
USER_API_KEY_ENV ||= "_DISCOURSE_USER_API"
|
||||
TOKEN_COOKIE ||= "_t"
|
||||
PATH_INFO ||= "PATH_INFO"
|
||||
COOKIE_ATTEMPTS_PER_MIN ||= 10
|
||||
|
||||
# do all current user initialization here
|
||||
@ -86,8 +86,11 @@ class Auth::DefaultCurrentUserProvider
|
||||
raise Discourse::InvalidAccess if current_user.suspended? || !current_user.active
|
||||
@env[API_KEY_ENV] = true
|
||||
|
||||
limiter_min = RateLimiter.new(nil, "admin_api_min_#{api_key}", GlobalSetting.max_admin_api_reqs_per_key_per_minute, 60)
|
||||
limiter_min.performed!
|
||||
# we do not run this rate limiter while profiling
|
||||
if Rails.env != "profile"
|
||||
limiter_min = RateLimiter.new(nil, "admin_api_min_#{api_key}", GlobalSetting.max_admin_api_reqs_per_key_per_minute, 60)
|
||||
limiter_min.performed!
|
||||
end
|
||||
end
|
||||
|
||||
# user api key handling
|
||||
|
Reference in New Issue
Block a user