demarches-normaliennes/app/controllers/ping_controller.rb
2020-06-22 11:17:22 +02:00

16 lines
462 B
Ruby

class PingController < ApplicationController
def index
Rails.logger.silence do
status_code = if File.file?(Rails.root.join("maintenance"))
# See https://cbonte.github.io/haproxy-dconv/2.0/configuration.html#4.2-http-check%20disable-on-404
:not_found
elsif (ActiveRecord::Base.connected?)
:ok
else
:internal_server_error
end
head status_code, content_type: "application/json"
end
end
end