Skip to content

Commit

Permalink
#8 - Add configuration for sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
anew-bhav committed Aug 8, 2019
1 parent 1e76e1b commit f2f86f9
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ gem 'uglifier', '>= 1.0.3'
gem 'byebug', '~>11.0.1'
gem 'puma', '~> 4.0.1'
gem 'twitter', '~> 6.2.0'
gem 'sentry-raven', '~> 2.11'
#gem 'jquery-rails'
gem "devise", "~> 4.6.2"
gem "omniauth", "~>1.9.0"
Expand Down
7 changes: 6 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,15 @@ GEM
erubi (1.8.0)
erubis (2.7.0)
execjs (2.7.0)
faraday (0.15.4)
multipart-post (>= 1.2, < 3)
ffi (1.11.1)
formtastic (3.1.5)
actionpack (>= 3.2.13)
formtastic_i18n (0.6.0)
globalid (0.4.2)
activesupport (>= 4.2.0)
haml (5.1.1)
haml (5.1.2)
temple (>= 0.8.0)
tilt
haml-rails (2.0.1)
Expand Down Expand Up @@ -244,6 +246,8 @@ GEM
sprockets (> 3.0)
sprockets-rails
tilt
sentry-raven (2.11.0)
faraday (>= 0.7.6, < 1.0)
sexp_processor (4.12.1)
simple_oauth (0.3.1)
sprockets (3.7.2)
Expand Down Expand Up @@ -310,6 +314,7 @@ DEPENDENCIES
pygmentize (~> 0.0.3)
rails (= 5.2.3)
redcarpet (~> 1.17.2)
sentry-raven (~> 2.11)
twitter (~> 6.2.0)
twitter-bootstrap-rails (~> 4.0.0)
uglifier (>= 1.0.3)
Expand Down
7 changes: 7 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
class ApplicationController < ActionController::Base
protect_from_forgery
before_action :set_raven_context

private
def set_raven_context
Raven.user_context(id: session[:current_user_id])
Raven.extra_context(params: params.to_unsafe_h, url: request.url)
end
end

4 changes: 4 additions & 0 deletions config/initializers/sentry.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Raven.configure do |config|
config.dsn = ENV['SENTRY_DSN']
config.sanitize_fields = Rails.application.config.filter_parameters.map(&:to_s)
end

0 comments on commit f2f86f9

Please sign in to comment.