Class: RailsMaint::Middleware
- Inherits:
-
Object
- Object
- RailsMaint::Middleware
- Includes:
- MaintenancePageHelper
- Defined in:
- lib/rails_maint/middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Middleware
constructor
A new instance of Middleware.
Methods included from MaintenancePageHelper
#available_locales, #default_maintenance_page_content
Constructor Details
#initialize(app) ⇒ Middleware
Returns a new instance of Middleware.
6 7 8 |
# File 'lib/rails_maint/middleware.rb', line 6 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/rails_maint/middleware.rb', line 10 def call(env) if maintenance_mode_enabled? && !ip_whitelisted?(env) [503, { 'Content-Type' => 'text/html' }, [maintenance_page]] else @app.call(env) end end |