class Prospector::Configuration

Attributes

client_secret[W]
enabled[W]
secret_token[W]

Public Class Methods

new() click to toggle source
# File lib/prospector/configuration.rb, line 7
def initialize
  @notified = false
end

Public Instance Methods

background_adapter() click to toggle source
# File lib/prospector/configuration.rb, line 25
def background_adapter
  @background_adapter ||= background_adapter_from_env || determine_default_background_adapater
end
background_adapter=(value) click to toggle source
# File lib/prospector/configuration.rb, line 29
def background_adapter=(value)
  @background_adapter = value.to_sym
end
client_secret() click to toggle source
# File lib/prospector/configuration.rb, line 37
def client_secret
  @client_secret || ENV['PROSPECTOR_CLIENT_SECRET'] || raise(InvalidCredentialsError)
end
enabled?() click to toggle source
# File lib/prospector/configuration.rb, line 11
def enabled?
  return @enabled unless @enabled.nil?

  @enabled = ENV['PROSPECTOR_ENABLED'] == 'true'
end
notified?() click to toggle source
# File lib/prospector/configuration.rb, line 21
def notified?
  @notified == true
end
notify!() click to toggle source
# File lib/prospector/configuration.rb, line 17
def notify!
  @notified = true
end
secret_token() click to toggle source
# File lib/prospector/configuration.rb, line 33
def secret_token
  @secret_token || ENV['PROSPECTOR_SECRET_TOKEN'] || raise(InvalidCredentialsError)
end

Private Instance Methods

background_adapter_from_env() click to toggle source
# File lib/prospector/configuration.rb, line 43
def background_adapter_from_env
  return if ENV['PROSPECTOR_BACKGROUND_ADAPTER'].nil?

  ENV['PROSPECTOR_BACKGROUND_ADAPTER'].to_sym
end
determine_default_background_adapater() click to toggle source
# File lib/prospector/configuration.rb, line 49
def determine_default_background_adapater
  return :active_job if defined?(ActiveJob)
  return :sidekiq if defined?(Sidekiq)

  :none
end