Module: Contrast::Agent::Inventory::DatabaseConfig

Extended by:
Components::Logger::InstanceMethods
Defined in:
lib/contrast/agent/inventory/database_config.rb

Overview

Methods used for parsing database connection configurations for getting inventory information from the application

Constant Summary collapse

ADAPTER =

TeamServer only accepts certain values for FlowMap Services. DO NOT CHANGE THIS

'adapter'
HOST =
'host'
PORT =
'port'
DATABASE =
'database'
DEFAULT =
'default'
LOCALHOST =
'localhost'

Class Method Summary collapse

Methods included from Components::Logger::InstanceMethods

cef_logger, logger

Class Method Details

.append_db_config(activity_or_update, hash_or_str = active_record_config) ⇒ Object

Append the available database connection information to the message being sent to TeamServer.

Parameters:



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/contrast/agent/inventory/database_config.rb', line 31

def append_db_config activity_or_update, hash_or_str = active_record_config
  arr = build_from_db_config(hash_or_str)
  return unless arr&.any?

  arr.each do |component|
    next unless component

    if activity_or_update.cs__is_a?(Contrast::Agent::Reporting::ApplicationUpdate)
      activity_or_update.components << component
    else
      activity_or_update.attach_inventory(component)
    end
  end
rescue StandardError => e
  logger.warn('Unable to append db config', e)
  nil
end