Class: Livestation::Healthcheck::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/livestation-healthcheck.rb

Instance Method Summary collapse

Constructor Details

#initialize(application) ⇒ Middleware



7
8
9
# File 'lib/livestation-healthcheck.rb', line 7

def initialize(application)
  @application = application
end

Instance Method Details

#call(environment) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/livestation-healthcheck.rb', line 11

def call(environment)
  if environment['PATH_INFO'] == '/status'
    [200,{},['OK']]
    # If you wanna make this more interesting...
    # if HealthCheck.healthy?
    #   [200, {}, ['OK']]
    # else
    #   [500, {}, ['PROBLEM']]
    # end
  else
    @application.call(environment)
  end
end