Only enable rollbar if it's configured

Many users who didn't configure rollbar were getting exceptions when
trying to connect to the rollbar service.
This commit is contained in:
Javi Martín
2020-04-26 13:34:57 +02:00
parent 83fb7a769c
commit 6db5e1ed55

View File

@@ -7,7 +7,7 @@ Rollbar.configure do |config|
# Here we'll disable all environments except 'staging', 'preproduction' and 'production': # Here we'll disable all environments except 'staging', 'preproduction' and 'production':
if Rails.env.staging? || Rails.env.preproduction? || Rails.env.production? if Rails.env.staging? || Rails.env.preproduction? || Rails.env.production?
config.enabled = true config.enabled = Rails.application.secrets.rollbar_server_token.present?
else else
config.enabled = false config.enabled = false
end end