Class: ScoutApm::Config
- Inherits:
-
Object
- Object
- ScoutApm::Config
- Defined in:
- lib/scout_apm/config.rb
Constant Summary collapse
- DEFAULTS =
{ 'host' => 'https://apm.scoutapp.com', 'log_level' => 'info', }.freeze
Instance Method Summary collapse
-
#initialize(config_path = nil) ⇒ Config
constructor
A new instance of Config.
-
#value(key) ⇒ Object
Fetch a config value.
Constructor Details
#initialize(config_path = nil) ⇒ Config
Returns a new instance of Config.
13 14 15 |
# File 'lib/scout_apm/config.rb', line 13 def initialize(config_path = nil) @config_path = config_path end |
Instance Method Details
#value(key) ⇒ Object
Fetch a config value. It first attempts to fetch an ENV var prefixed with ‘SCOUT_’, then from the settings file.
20 21 22 23 |
# File 'lib/scout_apm/config.rb', line 20 def value(key) value = ENV['SCOUT_'+key.upcase] || settings[key] value.to_s.strip.length.zero? ? nil : value end |