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)


336
337
338
339
340
# File 'lib/scout_apm/config.rb', line 336

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

#has_key?(key) ⇒ Boolean

Returns:

  • (Boolean)


328
329
330
# File 'lib/scout_apm/config.rb', line 328

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

#key_to_env_key(key) ⇒ Object



332
333
334
# File 'lib/scout_apm/config.rb', line 332

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

#nameObject



342
343
344
# File 'lib/scout_apm/config.rb', line 342

def name
  "environment"
end

#value(key) ⇒ Object



323
324
325
326
# File 'lib/scout_apm/config.rb', line 323

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