DHH introduce default HealthCheckController for Rails 7 ♦
Which is just this piece of code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true
class Rails::HealthController < ActionController::Base # :nodoc:
rescue_from(Exception) { render_down }
def show
render_up
end
private
def render_up
render html: html_status(color: "green")
end
def render_down
render html: html_status(color: "red"), status: 500
end
def html_status(color:)
%(<html><body style="background-color: #{color}"></body></html>).html_safe
end
end
Comments powered by Talkyard.