class AplApiConfig include ApiCache def initialize(app) @app = app end def call(env) bu = Thread.current[:apl_bu] method = env['REQUEST_METHOD'] uri = env['REQUEST_URI'] logger.info "Params in rack - #{bu}, #{method}, #{uri}" disabled = check_api_disabled bu, method, uri return [503, {'Content-Type' => 'text/plain'}, ['Api is temporarily unavailable']] if disabled @app.call(env) end end