aboutsummaryrefslogtreecommitdiffstats
path: root/config/initializers
diff options
context:
space:
mode:
Diffstat (limited to 'config/initializers')
-rw-r--r--config/initializers/alaveteli.rb5
-rw-r--r--config/initializers/health_checks.rb23
2 files changed, 27 insertions, 1 deletions
diff --git a/config/initializers/alaveteli.rb b/config/initializers/alaveteli.rb
index 9ea6428ba..3a1220326 100644
--- a/config/initializers/alaveteli.rb
+++ b/config/initializers/alaveteli.rb
@@ -44,7 +44,6 @@ require 'world_foi_websites.rb'
require 'alaveteli_external_command.rb'
require 'quiet_opener.rb'
require 'mail_handler'
-require 'public_body_categories'
require 'ability'
require 'normalize_string'
require 'alaveteli_file_types'
@@ -54,6 +53,9 @@ require 'theme'
require 'xapian_queries'
require 'date_quarter'
require 'public_body_csv'
+require 'category_and_heading_migrator'
+require 'public_body_categories'
+require 'routing_filters'
AlaveteliLocalization.set_locales(AlaveteliConfiguration::available_locales,
AlaveteliConfiguration::default_locale)
@@ -62,3 +64,4 @@ AlaveteliLocalization.set_locales(AlaveteliConfiguration::available_locales,
if Rails.env == 'test' and ActiveRecord::Base.configurations['test']['constraint_disabling'] == false
require 'no_constraint_disabling'
end
+
diff --git a/config/initializers/health_checks.rb b/config/initializers/health_checks.rb
new file mode 100644
index 000000000..7fd1d3dda
--- /dev/null
+++ b/config/initializers/health_checks.rb
@@ -0,0 +1,23 @@
+Rails.application.config.after_initialize do
+ user_last_created = HealthChecks::Checks::DaysAgoCheck.new(
+ :failure_message => _('The last user was created over a day ago'),
+ :success_message => _('The last user was created in the last day')) do
+ User.last.created_at
+ end
+
+ incoming_message_last_created = HealthChecks::Checks::DaysAgoCheck.new(
+ :failure_message => _('The last incoming message was created over a day ago'),
+ :success_message => _('The last incoming message was created in the last day')) do
+ IncomingMessage.last.created_at
+ end
+
+ outgoing_message_last_created = HealthChecks::Checks::DaysAgoCheck.new(
+ :failure_message => _('The last outgoing message was created over a day ago'),
+ :success_message => _('The last outgoing message was created in the last day')) do
+ OutgoingMessage.last.created_at
+ end
+
+ HealthChecks.add user_last_created
+ HealthChecks.add incoming_message_last_created
+ HealthChecks.add outgoing_message_last_created
+end