do not require newrelic or airbrake unless they are configured
This commit is contained in:
parent
7fd606ba19
commit
ebfc3de878
5 changed files with 27 additions and 15 deletions
4
Gemfile
4
Gemfile
|
|
@ -28,8 +28,8 @@ gem 'messagebus_ruby_api', '1.0.1'
|
|||
|
||||
group :production do # we don't install these on travis to speed up test runs
|
||||
# reporting
|
||||
gem 'airbrake'
|
||||
gem 'newrelic_rpm'
|
||||
gem 'airbrake', :require => false
|
||||
gem 'newrelic_rpm', :require => false
|
||||
gem 'rack-google-analytics', :require => 'rack/google-analytics'
|
||||
gem 'rack-piwik', :require => 'rack/piwik'
|
||||
gem 'rack-ssl', :require => 'rack/ssl'
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ HELP
|
|||
normalize_pod_url
|
||||
normalize_admins
|
||||
normalize_pod_services
|
||||
deprecate_hoptoad_api_key
|
||||
end
|
||||
|
||||
def self.config_file_is_old_style?
|
||||
|
|
@ -127,6 +128,13 @@ HELP
|
|||
end
|
||||
end
|
||||
|
||||
def deprecate_hoptoad_api_key
|
||||
if self[:hoptoad_api_key].present?
|
||||
$stderr.puts "WARNING: Please change hoptoad_api_key to airbrake_api_key in your application.yml"
|
||||
self[:airbrake_api_key] = self[:hoptoad_api_key]
|
||||
end
|
||||
end
|
||||
|
||||
load!
|
||||
|
||||
def self.[] (key)
|
||||
|
|
|
|||
10
config/initializers/airbrake.rb
Normal file
10
config/initializers/airbrake.rb
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# Copyright (c) 2012, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
if AppConfig[:airbrake_api_key].present?
|
||||
require 'airbrake'
|
||||
Airbrake.configure do |config|
|
||||
config.api_key = AppConfig[:airbrake_api_key]
|
||||
end
|
||||
end
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
# if old key still there, use it for new API,
|
||||
# update application.yml to use airbrake_api_key instead
|
||||
# (Former Hoptoad)
|
||||
if AppConfig[:airbrake_api_key].present?
|
||||
Airbrake.configure do |config|
|
||||
config.api_key = AppConfig[:airbrake_api_key]
|
||||
end
|
||||
elsif AppConfig[:hoptoad_api_key].present?
|
||||
puts "You're using old hoptoad_api_key, please update application.yml to use airbrake_api_key instead."
|
||||
Airbrake.configure do |config|
|
||||
config.api_key = AppConfig[:hoptoad_api_key]
|
||||
end
|
||||
end
|
||||
7
config/initializers/newrelic.rb
Normal file
7
config/initializers/newrelic.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# Copyright (c) 2012, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
if EnviromentConfiguration.using_new_relic?
|
||||
require 'newrelic_rpm'
|
||||
end
|
||||
Loading…
Reference in a new issue