Class: Contrast::Config::ServerConfiguration

Inherits:
Object
  • Object
show all
Includes:
Contrast::Components::ComponentBase, BaseConfiguration
Defined in:
lib/contrast/config/server_configuration.rb

Overview

Common Configuration settings. Those in this section pertain to the server identification functionality of the Agent.

Constant Summary collapse

CANON_NAME =
'server'
CONFIG_VALUES =
%w[tags environment version].cs__freeze

Constants included from Contrast::Components::ComponentBase

Contrast::Components::ComponentBase::ENABLE

Constants included from Diagnostics::Tools

Diagnostics::Tools::CHECK

Constants included from Diagnostics::SingletonTools

Diagnostics::SingletonTools::API_CREDENTIALS, Diagnostics::SingletonTools::CONTRAST_MARK

Constants included from BaseConfiguration

BaseConfiguration::AT_UNDERSCORE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Contrast::Components::ComponentBase

#false?, #file_exists?, #stringify_array, #true?, #valid_cert?

Methods included from Diagnostics::Tools

#add_effective_config_values, #add_single_effective_value

Methods included from Diagnostics::SingletonTools

#flatten_settings, #to_config_values, #update_config, #value_to_s

Methods included from BaseConfiguration

#to_contrast_hash

Constructor Details

#initialize(hsh = {}) ⇒ ServerConfiguration

Returns a new instance of ServerConfiguration.



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/contrast/config/server_configuration.rb', line 33

def initialize hsh = {}
  @config_values = CONFIG_VALUES
  @canon_name = CANON_NAME
  return unless hsh

  @path = hsh[:path]
  @name = hsh[:name]
  @type = hsh[:type]
  @tags = hsh[:tags]
  @environment = hsh[:environment]
  @version = hsh[:version]
end

Instance Attribute Details

#canon_nameString (readonly)

Returns:



29
30
31
# File 'lib/contrast/config/server_configuration.rb', line 29

def canon_name
  @canon_name
end

#config_valuesArray (readonly)

Returns:

  • (Array)


31
32
33
# File 'lib/contrast/config/server_configuration.rb', line 31

def config_values
  @config_values
end

#environmentString?

Returns:



25
26
27
# File 'lib/contrast/config/server_configuration.rb', line 25

def environment
  @environment
end

#nameString?

Returns:



18
19
20
# File 'lib/contrast/config/server_configuration.rb', line 18

def name
  @name
end

#pathString?

Returns:



20
21
22
# File 'lib/contrast/config/server_configuration.rb', line 20

def path
  @path
end

#tagsString?

Returns:



47
48
49
# File 'lib/contrast/config/server_configuration.rb', line 47

def tags
  stringify_array(@tags)
end

#typeString?

Returns:



22
23
24
# File 'lib/contrast/config/server_configuration.rb', line 22

def type
  @type
end

#versionString?

Returns:



27
28
29
# File 'lib/contrast/config/server_configuration.rb', line 27

def version
  @version
end

Instance Method Details

#to_effective_config(effective_config) ⇒ Object

Converts current configuration to effective config values class and appends them to EffectiveConfig class.

Parameters:



55
56
57
58
59
60
# File 'lib/contrast/config/server_configuration.rb', line 55

def to_effective_config effective_config
  super
  add_single_effective_value(effective_config, 'type', Contrast::APP_CONTEXT.server_type, CANON_NAME)
  add_single_effective_value(effective_config, 'name', Contrast::APP_CONTEXT.server_name, CANON_NAME)
  add_single_effective_value(effective_config, 'path', Contrast::APP_CONTEXT.server_path, CANON_NAME)
end