Class: Eureka::Health

Inherits:
Object
  • Object
show all
Defined in:
lib/eureka/health.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Health

Returns a new instance of Health.



5
6
7
# File 'lib/eureka/health.rb', line 5

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/eureka/health.rb', line 9

def call(env)
  @req = Rack::Request.new(env)
  if @req.path == '/health.json'
    [200, { 'Content-Type' => 'application/json' }, [ {status: 'UP'}.to_json ]]
  else
    @app.call(env)
  end
end