(P4DEVOPS-9434) Wire RateLimiter middleware into API Rack stack

This commit is contained in:
Mahima Singh 2026-03-19 11:43:34 +05:30
parent 2d4eec1f85
commit dfb2a384ab

View file

@ -3,7 +3,7 @@
module Vmpooler
class API < Sinatra::Base
# Load API components
%w[helpers dashboard v3 request_logger healthcheck].each do |lib|
%w[helpers dashboard v3 request_logger healthcheck rate_limiter].each do |lib|
require "vmpooler/api/#{lib}"
end
# Load dashboard components
@ -50,6 +50,11 @@ module Vmpooler
# Enable API request logging only if required
use Vmpooler::API::RequestLogger, logger: logger if config[:config]['request_logger']
# Enable rate limiting if configured
if config[:config]['rate_limiting_enabled']
use Vmpooler::API::RateLimiter, redis, config
end
use Vmpooler::Dashboard
use Vmpooler::API::Dashboard
use Vmpooler::API::V3