Class: LcpRuby::HealthController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/lcp_ruby/health_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



3
4
5
6
7
8
9
10
11
12
13
# File 'app/controllers/lcp_ruby/health_controller.rb', line 3

def show
  checks = {
    database: database_healthy?,
    booted: LcpRuby.booted?
  }

  healthy = checks.values.all?
  status_code = healthy ? :ok : :service_unavailable

  render json: { status: healthy ? "ok" : "error", checks: checks }, status: status_code
end