class Healthcheck::Middleware

Public Class Methods

new(app) click to toggle source
# File lib/healthcheck/middleware.rb, line 3
def initialize(app)
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# File lib/healthcheck/middleware.rb, line 7
def call(env)
  if env['PATH_INFO'] == '/healthcheck'
    [ 200, { 'Content-Type' => 'application/json' }, [ body.to_json ] ]
  else
    @app.call env
  end
end

Private Instance Methods

body() click to toggle source
# File lib/healthcheck/middleware.rb, line 16
def body
  { commit: ENV['GIT_COMMIT'].to_s }
end