Class: NewRelic::Agent::Configuration::YamlSource
- Inherits:
-
DottedHash
- Object
- Hash
- DottedHash
- NewRelic::Agent::Configuration::YamlSource
show all
- Defined in:
- lib/new_relic/agent/configuration/yaml_source.rb
Constant Summary
collapse
- CONFIG_WITH_HASH_VALUE =
These are configuration options that have a value of a Hash This is used in YamlSource#dot_flattened prevent flattening these values
%w[expected_messages ignore_messages]
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from DottedHash
#inspect, symbolize, #to_hash
Constructor Details
Returns a new instance of YamlSource.
[View source]
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/new_relic/agent/configuration/yaml_source.rb', line 18
def initialize(path, env)
@path = path
config = {}
@failures = []
@generated_for_user = ''
@license_key = ''
begin
@file_path = validate_config_file_path(path)
return unless @file_path
::NewRelic::Agent.logger.info("Reading configuration from #{path} (#{Dir.pwd})")
raw_file = File.read(@file_path)
erb_file = process_erb(raw_file)
config = process_yaml(erb_file, env, config, @file_path)
rescue ScriptError, StandardError => e
NewRelic::Agent.agent.health_check.update_status(NewRelic::Agent::HealthCheck::FAILED_TO_PARSE_CONFIG)
log_failure("Failed to read or parse configuration file at #{path}", e)
end
substitute_transaction_threshold(config)
booleanify_values(config, 'agent_enabled', 'enabled')
apply_aliases(config)
super(config, true)
end
|
Instance Attribute Details
permalink
#failures ⇒ Object
11
12
13
|
# File 'lib/new_relic/agent/configuration/yaml_source.rb', line 11
def failures
@failures
end
|
permalink
#file_path ⇒ Object
11
12
13
|
# File 'lib/new_relic/agent/configuration/yaml_source.rb', line 11
def file_path
@file_path
end
|
permalink
#generated_for_user ⇒ Object
12
13
14
|
# File 'lib/new_relic/agent/configuration/yaml_source.rb', line 12
def generated_for_user
@generated_for_user
end
|
permalink
#license_key ⇒ Object
12
13
14
|
# File 'lib/new_relic/agent/configuration/yaml_source.rb', line 12
def license_key
@license_key
end
|
Instance Method Details
[View source]
50
51
52
|
# File 'lib/new_relic/agent/configuration/yaml_source.rb', line 50
def failed?
!@failures.empty?
end
|