From d203f439463adfd13aa220c12eb0808f98d4345e Mon Sep 17 00:00:00 2001 From: Ahmad Farhat Date: Fri, 6 Sep 2019 17:09:43 -0400 Subject: [PATCH] GRN2-237: Added DB migration error check to health check (#790) * Added DB migration error check to health check * Switch nil to blank --- config/initializers/health_check.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/config/initializers/health_check.rb b/config/initializers/health_check.rb index 35e5acf9..9b7260f8 100644 --- a/config/initializers/health_check.rb +++ b/config/initializers/health_check.rb @@ -24,11 +24,16 @@ HealthCheck.setup do |config| config.http_status_for_error_object = 500 # You can customize which checks happen on a standard health check, eg to set an explicit list use: - config.standard_checks = %w(database migrations emailconf) + config.standard_checks = %w(database migrations emailconf db-migration) # You can set what tests are run with the 'full' or 'all' parameter config.full_checks = %w(database migrations email cache) + config.add_custom_check('db-migration') do + # any code that returns blank on success and non blank string upon failure + ENV["DB_MIGRATE_FAILED"].blank? ? "" : "Database migration failed" + end + # max-age of response in seconds # cache-control is public when max_age > 1 and basic_auth_username is not set # You can force private without authentication for longer max_age by