Create a file at config/initializers/health_check.rb to customize the gem's behavior. You can configure the URI prefix, success/failure messages, log levels, authentication, and specific checks to run.
HealthCheck.setup do |config|
config.uri = 'health_check'
config.success = 'success'
config.failure = 'health_check failed'
config.include_error_in_response_body = false
config.log_level = 'info'
config.smtp_timeout = 30.0
config.http_status_for_error_text = 500
config.http_status_for_error_object = 500
config.buckets = {'bucket_name' => [:R, :W, :D]}
config.standard_checks = [ 'database', 'migrations', 'custom' ]
config.full_checks = ['database', 'migrations', 'custom', 'email', 'cache', 'redis', 'resque-redis', 'sidekiq-redis', 's3']
config.max_age = 1
config.basic_auth_username = 'my_username'
config.basic_auth_password = 'my_password'
config.origin_ip_whitelist = %w(123.123.123.123 10.11.12.0/24 2400:cb00::/32)
config.accept_proxied_requests = false
config.http_status_for_ip_whitelist_error = 403
config.rabbitmq_config = {}
config.redis_url = 'redis_url'
config.redis_password = 'redis_password'
config.on_failure do |checks, msg|
# log msg somewhere
end
config.on_success do |checks|
# flag that everything is well
end
end