Sha256: f4e59fc1552eb007aac19f5f871d60c8013f8d52912b6f0b447242ef4f749ccf
Contents?: true
Size: 585 Bytes
Versions: 2
Compression:
Stored size: 585 Bytes
Contents
module ShuntCache class Middleware attr_accessor :endpoint_matcher def initialize(app, options = {}) @app = app @endpoint_matcher = options.fetch(:endpoint) do "/options/full_stack_status" end end def call(env) path = env.fetch('REQUEST_PATH') do env.fetch('PATH_INFO') do env.fetch('REQUEST_URI', '') end end if path.match(endpoint_matcher) && ShuntCache::Status.shunted? return ['503', {'Content-Type' => 'text/html'}, ['Maintenance']] end @app.call(env) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
shunt_cache-0.1.0 | lib/shunt_cache/middleware.rb |
shunt_cache-0.0.2 | lib/shunt_cache/middleware.rb |