Class: OneApm::Configuration::YamlSource
- Inherits:
-
Support::DottedHash
- Object
- Hash
- Support::DottedHash
- OneApm::Configuration::YamlSource
- Defined in:
- lib/one_apm/configuration/yaml_source.rb
Instance Attribute Summary collapse
-
#file_path ⇒ Object
Returns the value of attribute file_path.
Instance Method Summary collapse
-
#initialize(path, env) ⇒ YamlSource
constructor
A new instance of YamlSource.
Methods inherited from Support::DottedHash
Constructor Details
#initialize(path, env) ⇒ YamlSource
Returns a new instance of YamlSource.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/one_apm/configuration/yaml_source.rb', line 13 def initialize(path, env) config = {} begin @file_path = validate_config_file_path(path) return unless @file_path OneApm::Manager.logger.info("Reading configuration from #{path} (#{Dir.pwd})") raw_file = if RUBY_VERSION >= '1.9.3' File.read(@file_path, :encoding => 'utf-8') else File.read(@file_path) end erb_file = process_erb(raw_file) config = process_yaml(erb_file, env, config, @file_path) add_notified!(config) rescue ScriptError, StandardError => e OneApm::Manager.logger.error("Failed to read or parse configuration file at #{path}", e) end substitute_transaction_threshold(config) booleanify_values(config, 'agent_enabled', 'enabled', 'monitor_daemons') super(config, true) end |
Instance Attribute Details
#file_path ⇒ Object
Returns the value of attribute file_path.
11 12 13 |
# File 'lib/one_apm/configuration/yaml_source.rb', line 11 def file_path @file_path end |