Class: ScoutApm::Config::ConfigEnvironment

Inherits:
Object
  • Object
show all
Defined in:
lib/scout_apm/config.rb

Instance Method Summary collapse

Instance Method Details

#any_keys_found?Boolean

Returns:

  • (Boolean)


384
385
386
387
388
# File 'lib/scout_apm/config.rb', line 384

def any_keys_found?
  KNOWN_CONFIG_OPTIONS.any? { |option|
    ENV.has_key?(key_to_env_key(option))
  }
end

#has_key?(key) ⇒ Boolean

Returns:

  • (Boolean)


376
377
378
# File 'lib/scout_apm/config.rb', line 376

def has_key?(key)
  ENV.has_key?(key_to_env_key(key))
end

#key_to_env_key(key) ⇒ Object



380
381
382
# File 'lib/scout_apm/config.rb', line 380

def key_to_env_key(key)
  'SCOUT_' + key.upcase
end

#nameObject



390
391
392
# File 'lib/scout_apm/config.rb', line 390

def name
  "environment"
end

#value(key) ⇒ Object



371
372
373
374
# File 'lib/scout_apm/config.rb', line 371

def value(key)
  val = ENV[key_to_env_key(key)]
  val.to_s.strip.length.zero? ? nil : val
end