class HeyDoctor::Rack::HealthCheck

Public Instance Methods

call(_env) click to toggle source
# File lib/hey_doctor.rb, line 8
def call(_env)
  [200, {}, [status]]
end

Private Instance Methods

status() click to toggle source
# File lib/hey_doctor.rb, line 14
def status
  response = {
    app: ::HeyDoctor::CheckApplicationHealthService.call,
    database: ::HeyDoctor::CheckDatabaseHealthService.call
  }

  unless ENV['REDIS_URL'].blank?
    response.merge!({ redis: ::HeyDoctor::CheckRedisHealthService.call })
  end

  unless ENV['SIDEKIQ_HOSTS'].blank?
    response.merge!(
      { sidekiq: ::HeyDoctor::CheckSidekiqHealthService.call }
    )
  end

  response.to_json
end