mirror of
http://ghproxy.cn/https://github.com/multunus/onemdm-server
synced 2025-12-06 10:14:59 +00:00
Integrate Rollbar, made the access token as env varibale
This commit is contained in:
1
Gemfile
1
Gemfile
@@ -24,6 +24,7 @@ gem 'sdoc', '~> 0.4.0', group: :doc
|
|||||||
gem 'pg'
|
gem 'pg'
|
||||||
gem 'devise'
|
gem 'devise'
|
||||||
gem 'activeadmin', github: 'activeadmin'
|
gem 'activeadmin', github: 'activeadmin'
|
||||||
|
gem 'rollbar', '~> 2.5.0'
|
||||||
|
|
||||||
# Use ActiveModel has_secure_password
|
# Use ActiveModel has_secure_password
|
||||||
# gem 'bcrypt', '~> 3.1.7'
|
# gem 'bcrypt', '~> 3.1.7'
|
||||||
|
|||||||
@@ -172,6 +172,8 @@ GEM
|
|||||||
ref (2.0.0)
|
ref (2.0.0)
|
||||||
responders (2.1.0)
|
responders (2.1.0)
|
||||||
railties (>= 4.2.0, < 5)
|
railties (>= 4.2.0, < 5)
|
||||||
|
rollbar (2.5.2)
|
||||||
|
multi_json
|
||||||
rspec-core (3.3.2)
|
rspec-core (3.3.2)
|
||||||
rspec-support (~> 3.3.0)
|
rspec-support (~> 3.3.0)
|
||||||
rspec-expectations (3.3.1)
|
rspec-expectations (3.3.1)
|
||||||
@@ -248,6 +250,7 @@ DEPENDENCIES
|
|||||||
jquery-rails
|
jquery-rails
|
||||||
pg
|
pg
|
||||||
rails (= 4.2.4)
|
rails (= 4.2.4)
|
||||||
|
rollbar (~> 2.5.0)
|
||||||
rspec-rails
|
rspec-rails
|
||||||
sass-rails (~> 5.0)
|
sass-rails (~> 5.0)
|
||||||
sdoc (~> 0.4.0)
|
sdoc (~> 0.4.0)
|
||||||
|
|||||||
50
config/initializers/rollbar.rb
Normal file
50
config/initializers/rollbar.rb
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
Rollbar.configure do |config|
|
||||||
|
# Without configuration, Rollbar is enabled in all environments.
|
||||||
|
# To disable in specific environments, set config.enabled=false.
|
||||||
|
|
||||||
|
config.access_token = ENV['ROLLBAR_ACCESS_TOKEN']
|
||||||
|
|
||||||
|
# Here we'll disable in 'test':
|
||||||
|
if Rails.env.test?
|
||||||
|
config.enabled = false
|
||||||
|
end
|
||||||
|
|
||||||
|
# By default, Rollbar will try to call the `current_user` controller method
|
||||||
|
# to fetch the logged-in user object, and then call that object's `id`,
|
||||||
|
# `username`, and `email` methods to fetch those properties. To customize:
|
||||||
|
# config.person_method = "my_current_user"
|
||||||
|
# config.person_id_method = "my_id"
|
||||||
|
# config.person_username_method = "my_username"
|
||||||
|
# config.person_email_method = "my_email"
|
||||||
|
|
||||||
|
# If you want to attach custom data to all exception and message reports,
|
||||||
|
# provide a lambda like the following. It should return a hash.
|
||||||
|
# config.custom_data_method = lambda { {:some_key => "some_value" } }
|
||||||
|
|
||||||
|
# Add exception class names to the exception_level_filters hash to
|
||||||
|
# change the level that exception is reported at. Note that if an exception
|
||||||
|
# has already been reported and logged the level will need to be changed
|
||||||
|
# via the rollbar interface.
|
||||||
|
# Valid levels: 'critical', 'error', 'warning', 'info', 'debug', 'ignore'
|
||||||
|
# 'ignore' will cause the exception to not be reported at all.
|
||||||
|
# config.exception_level_filters.merge!('MyCriticalException' => 'critical')
|
||||||
|
#
|
||||||
|
# You can also specify a callable, which will be called with the exception instance.
|
||||||
|
# config.exception_level_filters.merge!('MyCriticalException' => lambda { |e| 'critical' })
|
||||||
|
|
||||||
|
# Enable asynchronous reporting (uses girl_friday or Threading if girl_friday
|
||||||
|
# is not installed)
|
||||||
|
# config.use_async = true
|
||||||
|
# Supply your own async handler:
|
||||||
|
# config.async_handler = Proc.new { |payload|
|
||||||
|
# Thread.new { Rollbar.process_from_async_handler(payload) }
|
||||||
|
# }
|
||||||
|
|
||||||
|
# Enable asynchronous reporting (using sucker_punch)
|
||||||
|
# config.use_sucker_punch
|
||||||
|
|
||||||
|
# Enable delayed reporting (using Sidekiq)
|
||||||
|
# config.use_sidekiq
|
||||||
|
# You can supply custom Sidekiq options:
|
||||||
|
# config.use_sidekiq 'queue' => 'default'
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user