Method: Binnacle::Configuration#initialize

Defined in:
lib/binnacle/configuration.rb

#initializeConfiguration

Returns a new instance of Configuration.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/binnacle/configuration.rb', line 80

def initialize
  if ENV['BINNACLE_ENDPOINT']
    self.endpoint    ||= ENV['BINNACLE_ENDPOINT'].include?(',') ? ENV['BINNACLE_ENDPOINT'].split(',') : ENV['BINNACLE_ENDPOINT']
  else
    if self.endpoint !~ /[^[:space:]]/
      self.endpoint = (1..6).to_a.sample(3).map { |n| "api#{n}.binnacle-api.io" }
    end
  end

  self.logging_channel ||= ENV['BINNACLE_APP_LOG_CHANNEL']
  self.error_channel   ||= ENV['BINNACLE_APP_ERR_CHANNEL']
  self.api_key     ||= ENV['BINNACLE_API_KEY']
  self.api_secret  ||= ENV['BINNACLE_API_SECRET']
  self.intercept_rails_logging = Configuration.set_boolean_flag_for(ENV['BINNACLE_RAILS_LOG'])
  self.rails_verbose_logging = Configuration.set_boolean_flag_for(ENV['BINNACLE_RAILS_LOG_VERBOSE'])
  self.report_exceptions = Configuration.set_boolean_flag_for(ENV['BINNACLE_REPORT_EXCEPTIONS'])
  self.ignored_exceptions ||= ENV['BINNACLE_IGNORED_EXCEPTIONS'] ? DEFAULT_IGNORED_EXCEPTIONS + ENV['BINNACLE_IGNORED_EXCEPTIONS'].split(',') : DEFAULT_IGNORED_EXCEPTIONS
  self.ignore_cascade_pass     ||= true
  self.asynch_logging = Configuration.set_boolean_flag_for(ENV['BINNACLE_RAILS_LOG_ASYNCH'], true)
  @encrypted = Configuration.set_boolean_flag_for(ENV['BINNACLE_ENCRYPTED'], true)

  self.url_whitelist_patterns ||= ENV['BINNACLE_HTTP_LOGGING_WHITELIST'] ? ENV['BINNACLE_HTTP_LOGGING_WHITELIST'].split(',') : []
  self.url_blacklist_patterns ||= ENV['BINNACLE_HTTP_LOGGING_BLACKLIST'] ? ENV['BINNACLE_HTTP_LOGGING_BLACKLIST'].split(',') : []
  @url_whitelist_pattern = /.*/
  @url_blacklist_pattern = nil

  self.log_binnacle_signals = Configuration.set_boolean_flag_for(ENV['BINNACLE_LOG_SIGNALS'])

  prepare!
end