Method: NewRelic::Agent::Configuration::Manager#replace_or_add_config

Defined in:
lib/new_relic/agent/configuration/manager.rb

#replace_or_add_config(source) ⇒ Object

[View source]

81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/new_relic/agent/configuration/manager.rb', line 81

def replace_or_add_config(source)
  source.freeze
  was_finished = finished_configuring?

  invoke_callbacks(:add, source)

  case source
  when SecurityPolicySource then @security_policy_source = source
  when HighSecuritySource then @high_security_source = source
  when EnvironmentSource then @environment_source = source
  when ServerSource then @server_source = source
  when ManualSource then @manual_source = source
  when YamlSource then @yaml_source = source
  when DefaultSource then @default_source = source
  else
    NewRelic::Agent.logger.warn("Invalid config format; config will be ignored: #{source}")
  end

  reset_cache
  log_config(:add, source)

  notify_server_source_added if ServerSource === source
  notify_finished_configuring if !was_finished && finished_configuring?
end