Commit f2acdc5a94c609702979e55b30b3ef540de4240a

Authored by Rafael Manzo
Committed by Diego Camarinha
1 parent 46023e56

Exception notification for production environment

Gemfile
... ... @@ -57,6 +57,9 @@ gem 'sdoc', require: false
57 57 # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
58 58 gem 'spring', group: :development
59 59  
  60 +# Sends a email whenever there is a unexpected exception
  61 +gem 'exception_notification', '~> 4.0.1'
  62 +
60 63 group :test do
61 64 # Easier test writing
62 65 gem "shoulda-matchers", '~> 2.6.1'
... ...
Gemfile.lock
... ... @@ -109,6 +109,9 @@ GEM
109 109 diff-lcs (1.2.5)
110 110 docile (1.1.5)
111 111 erubis (2.7.0)
  112 + exception_notification (4.0.1)
  113 + actionmailer (>= 3.0.4)
  114 + activesupport (>= 3.0.4)
112 115 execjs (2.2.1)
113 116 factory_girl (4.4.0)
114 117 activesupport (>= 3.0.0)
... ... @@ -283,6 +286,7 @@ DEPENDENCIES
283 286 dalli (~> 2.7.0)
284 287 database_cleaner
285 288 devise (~> 3.3.0)
  289 + exception_notification (~> 4.0.1)
286 290 factory_girl_rails (~> 4.4.1)
287 291 jbuilder (~> 2.1.2)
288 292 jquery-rails
... ...
config/environments/production.rb
... ... @@ -86,4 +86,23 @@ Rails.application.configure do
86 86  
87 87 # Kalibro URL
88 88 KalibroGatekeeperClient.configure_with(Rails.root.join('config', 'kalibro_gatekeeper.yml'))
  89 +
  90 + # ActionMailer SMTP
  91 + config.action_mailer.delivery_method = :smtp
  92 + config.action_mailer.smtp_settings = {
  93 + address: 'smtp.gmail.com',
  94 + port: 587,
  95 + domain: 'mezuro.org',
  96 + user_name: "<%= ENV['SMTP_USERNAME'] %>", # Configure these as a environment vars on the production server
  97 + password: "<%= ENV['SMTP_PASSWORD'] %>",
  98 + authentication: 'plain',
  99 + enable_starttls_auto: true }
  100 +
  101 + # Exception Notification
  102 + config.middleware.use ExceptionNotification::Rack,
  103 + :email => {
  104 + :email_prefix => "[Prezento Error] ",
  105 + :sender_address => %{"mezurometrics" <mezurometrics@gmail.com>},
  106 + :exception_recipients => %w{mezuro-core@lists.ime.usp.br}
  107 + }
89 108 end
... ...