class Shift::CircuitBreaker::Config

Global Configuration Object

Example Usage:

Add an initializer in your application (eg. shift_circuit_breaker.rb) with the following configs:

Shift::CircuitBreaker.configure do |config|

config.new_relic_license_key  = ENV["NEW_RELIC_LICENSE_KEY"]
config.new_relic_app_name     = ENV["NEW_RELIC_APP_NAME"]
config.sentry_dsn             = ENV["SENTRY_DSN"]
config.sentry_environments    = %w[ production ]

end

Attributes

new_relic_app_name[RW]
new_relic_license_key[RW]
sentry_dsn[RW]
sentry_environments[RW]

Public Instance Methods

initialize_dependencies() click to toggle source
# File lib/shift/circuit_breaker/config.rb, line 25
def initialize_dependencies
  initialize_sentry
  initialize_newrelic
end

Private Instance Methods

initialize_newrelic() click to toggle source
# File lib/shift/circuit_breaker/config.rb, line 41
def initialize_newrelic
  if new_relic_app_name.present? && new_relic_license_key.present?
    require "newrelic_rpm"
  end
end
initialize_sentry() click to toggle source
# File lib/shift/circuit_breaker/config.rb, line 32
def initialize_sentry
  if sentry_dsn
    Raven.configure do |config|
      config.dsn = sentry_dsn
      config.environments = sentry_environments if sentry_environments.present?
    end
  end
end