Class: Contrast::Config::ServerConfiguration
- 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
Constants included from Diagnostics::SingletonTools
Diagnostics::SingletonTools::API_CREDENTIALS, Diagnostics::SingletonTools::CONTRAST_MARK
Constants included from BaseConfiguration
BaseConfiguration::AT_UNDERSCORE
Instance Attribute Summary collapse
- #canon_name ⇒ String readonly
- #config_values ⇒ Array readonly
- #environment ⇒ String?
- #name ⇒ String?
- #path ⇒ String?
- #tags ⇒ String?
- #type ⇒ String?
- #version ⇒ String?
Instance Method Summary collapse
-
#initialize(hsh = {}) ⇒ ServerConfiguration
constructor
A new instance of ServerConfiguration.
-
#to_effective_config(effective_config) ⇒ Object
Converts current configuration to effective config values class and appends them to EffectiveConfig class.
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
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_name ⇒ String (readonly)
29 30 31 |
# File 'lib/contrast/config/server_configuration.rb', line 29 def canon_name @canon_name end |
#config_values ⇒ Array (readonly)
31 32 33 |
# File 'lib/contrast/config/server_configuration.rb', line 31 def config_values @config_values end |
#environment ⇒ String?
25 26 27 |
# File 'lib/contrast/config/server_configuration.rb', line 25 def environment @environment end |
#name ⇒ String?
18 19 20 |
# File 'lib/contrast/config/server_configuration.rb', line 18 def name @name end |
#path ⇒ String?
20 21 22 |
# File 'lib/contrast/config/server_configuration.rb', line 20 def path @path end |
#tags ⇒ String?
47 48 49 |
# File 'lib/contrast/config/server_configuration.rb', line 47 def stringify_array(@tags) end |
#type ⇒ String?
22 23 24 |
# File 'lib/contrast/config/server_configuration.rb', line 22 def type @type end |
#version ⇒ String?
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.
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 |