diff options
-rw-r--r-- | app/controllers/application_controller.rb | 4 | ||||
-rw-r--r-- | config/environments/test.rb | 5 | ||||
-rw-r--r-- | config/test.yml | 2 |
3 files changed, 9 insertions, 2 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index cbdffc441..161a82b26 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -138,7 +138,9 @@ class ApplicationController < ActionController::Base backtrace = Rails.backtrace_cleaner.clean(exception.backtrace, :silent) message << " " << backtrace.join("\n ") Rails.logger.fatal("#{message}\n\n") - ExceptionNotifier::Notifier.exception_notification(request.env, exception).deliver + if !AlaveteliConfiguration.exception_notifications_from.blank? && !AlaveteliConfiguration.exception_notifications_to.blank? + ExceptionNotifier::Notifier.exception_notification(request.env, exception).deliver + end @status = 500 end respond_to do |format| diff --git a/config/environments/test.rb b/config/environments/test.rb index df39e8873..97c2d4f7c 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -24,4 +24,9 @@ Alaveteli::Application.configure do # Print deprecation notices to the stderr config.active_support.deprecation = :stderr + if !AlaveteliConfiguration.exception_notifications_from.blank? && !AlaveteliConfiguration.exception_notifications_to.blank? + middleware.use ExceptionNotifier, + :sender_address => AlaveteliConfiguration::exception_notifications_from, + :exception_recipients => AlaveteliConfiguration::exception_notifications_to + end end diff --git a/config/test.yml b/config/test.yml index b26ca99d4..599e1e81a 100644 --- a/config/test.yml +++ b/config/test.yml @@ -116,7 +116,7 @@ HTML_TO_PDF_COMMAND: /usr/local/bin/wkhtmltopdf-amd64 # Exception notifications EXCEPTION_NOTIFICATIONS_FROM: do-not-reply-to-this-address@example.com -EXCEPTION_NOTIFICATIONS_TO: +EXCEPTION_NOTIFICATIONS_TO: exception-recipient@example.com MAX_REQUESTS_PER_USER_PER_DAY: 2 |