module Gruf::Lightstep::Configuration

General configuration for lightstep integration

Constants

VALID_CONFIG_KEYS

Public Class Methods

extended(base) click to toggle source

Whenever this is extended into a class, setup the defaults

# File lib/gruf/lightstep/configuration.rb, line 34
def self.extended(base)
  base.reset
end

Public Instance Methods

configure() { |self| ... } click to toggle source

Yield self for ruby-style initialization

@yields [Bigcommerce::Instrumentation::Configuration] @return [Bigcommerce::Instrumentation::Configuration]

# File lib/gruf/lightstep/configuration.rb, line 44
def configure
  reset unless @configured
  yield self
  @configured = true
end
environment() click to toggle source

Automatically determine environment

# File lib/gruf/lightstep/configuration.rb, line 75
def environment
  if defined?(Rails)
    Rails.env
  else
    ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development'
  end
end
options() click to toggle source

Return the current configuration options as a Hash

@return [Hash]

# File lib/gruf/lightstep/configuration.rb, line 55
def options
  opts = {}
  VALID_CONFIG_KEYS.each_key do |k|
    opts.merge!(k => send(k))
  end
  opts
end
reset() click to toggle source

Set the default configuration onto the extended class

# File lib/gruf/lightstep/configuration.rb, line 66
def reset
  VALID_CONFIG_KEYS.each do |k, v|
    send("#{k}=".to_sym, v)
  end
end