Class: Contrast::Config::Diagnostics::UserConfigurationFile

Inherits:
Object
  • Object
show all
Defined in:
lib/contrast/config/diagnostics/user_configuration_file.rb

Overview

Reads all config files

Instance Method Summary collapse

Instance Method Details

#source_valuesObject

Returns all source values from all configuration files read from the Agent int => values format.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/contrast/config/diagnostics/user_configuration_file.rb', line 16

def source_values
  @_source_values ||= begin
    sources = {}
    Contrast::CONFIG.config.origin.source_files.each do |file|
      config = Contrast::Utils::HashUtils.deep_symbolize_all_keys(file.values)
      # Assign each source to it's file path
      sources[file.path] = Contrast::Config::Diagnostics::Tools.
          to_config_values(Contrast::Config::Diagnostics::Tools.
          flatten_settings(Contrast::Config::Diagnostics::Tools.
            value_to_s(config), config: config), source: true)
    end
    sources
  end
end

#to_controlled_hashObject



31
32
33
34
35
36
37
38
39
40
# File 'lib/contrast/config/diagnostics/user_configuration_file.rb', line 31

def to_controlled_hash
  arr = []
  source_values.each do |k, v|
    hsh = {}
    hsh[:path] = k
    hsh[:values] = v.map(&:to_source_hash)
    arr << hsh
  end
  arr
end