Commit f2acdc5a94c609702979e55b30b3ef540de4240a
Committed by
Diego Camarinha
1 parent
46023e56
Exists in
colab
and in
4 other branches
Exception notification for production environment
Showing
3 changed files
with
26 additions
and
0 deletions
Show diff stats
Gemfile
| @@ -57,6 +57,9 @@ gem 'sdoc', require: false | @@ -57,6 +57,9 @@ gem 'sdoc', require: false | ||
| 57 | # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring | 57 | # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring |
| 58 | gem 'spring', group: :development | 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 | group :test do | 63 | group :test do |
| 61 | # Easier test writing | 64 | # Easier test writing |
| 62 | gem "shoulda-matchers", '~> 2.6.1' | 65 | gem "shoulda-matchers", '~> 2.6.1' |
Gemfile.lock
| @@ -109,6 +109,9 @@ GEM | @@ -109,6 +109,9 @@ GEM | ||
| 109 | diff-lcs (1.2.5) | 109 | diff-lcs (1.2.5) |
| 110 | docile (1.1.5) | 110 | docile (1.1.5) |
| 111 | erubis (2.7.0) | 111 | erubis (2.7.0) |
| 112 | + exception_notification (4.0.1) | ||
| 113 | + actionmailer (>= 3.0.4) | ||
| 114 | + activesupport (>= 3.0.4) | ||
| 112 | execjs (2.2.1) | 115 | execjs (2.2.1) |
| 113 | factory_girl (4.4.0) | 116 | factory_girl (4.4.0) |
| 114 | activesupport (>= 3.0.0) | 117 | activesupport (>= 3.0.0) |
| @@ -283,6 +286,7 @@ DEPENDENCIES | @@ -283,6 +286,7 @@ DEPENDENCIES | ||
| 283 | dalli (~> 2.7.0) | 286 | dalli (~> 2.7.0) |
| 284 | database_cleaner | 287 | database_cleaner |
| 285 | devise (~> 3.3.0) | 288 | devise (~> 3.3.0) |
| 289 | + exception_notification (~> 4.0.1) | ||
| 286 | factory_girl_rails (~> 4.4.1) | 290 | factory_girl_rails (~> 4.4.1) |
| 287 | jbuilder (~> 2.1.2) | 291 | jbuilder (~> 2.1.2) |
| 288 | jquery-rails | 292 | jquery-rails |
config/environments/production.rb
| @@ -86,4 +86,23 @@ Rails.application.configure do | @@ -86,4 +86,23 @@ Rails.application.configure do | ||
| 86 | 86 | ||
| 87 | # Kalibro URL | 87 | # Kalibro URL |
| 88 | KalibroGatekeeperClient.configure_with(Rails.root.join('config', 'kalibro_gatekeeper.yml')) | 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 | end | 108 | end |