Method: TingYun::Configuration::Manager#replace_or_add_config

Defined in:
lib/ting_yun/configuration/manager.rb

#replace_or_add_config(source) ⇒ Object



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/ting_yun/configuration/manager.rb', line 160

def replace_or_add_config(source)
  source.freeze

  was_finished = finished_configuring?

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

  log_config(:add, source)

  TingYun::Agent.instance.events.notify(:finished_configuring) if !was_finished && finished_configuring?
end