Class: ACE::Config
- Inherits:
-
BoltServer::BaseConfig
- Object
- BoltServer::BaseConfig
- ACE::Config
- Defined in:
- lib/ace/config.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #config_keys ⇒ Object
- #defaults ⇒ Object
- #env_keys ⇒ Object
- #int_keys ⇒ Object
- #load_env_config ⇒ Object
- #make_compatible ⇒ Object
- #required_keys ⇒ Object
- #service_name ⇒ Object
- #ssl_keys ⇒ Object
- #validate ⇒ Object
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
8 9 10 |
# File 'lib/ace/config.rb', line 8 def data @data end |
Instance Method Details
#config_keys ⇒ Object
9 10 11 |
# File 'lib/ace/config.rb', line 9 def config_keys super + %w[concurrency cache-dir puppet-server-conn-timeout puppet-server-uri ssl-ca-crls] end |
#defaults ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/ace/config.rb', line 25 def defaults super.merge( 'port' => 44633, 'concurrency' => 10, 'cache-dir' => "/opt/puppetlabs/server/data/ace-server/cache", 'puppet-server-conn-timeout' => 120, 'file-server-conn-timeout' => 120 ) end |
#env_keys ⇒ Object
13 14 15 |
# File 'lib/ace/config.rb', line 13 def env_keys super + %w[concurrency puppet-server-conn-timeout puppet-server-uri ssl-ca-crls] end |
#int_keys ⇒ Object
21 22 23 |
# File 'lib/ace/config.rb', line 21 def int_keys %w[concurrency puppet-server-conn-timeout] end |
#load_env_config ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/ace/config.rb', line 43 def load_env_config env_keys.each do |key| transformed_key = "ACE_#{key.tr('-', '_').upcase}" next unless ENV.key?(transformed_key) @data[key] = if int_keys.include?(key) ENV[transformed_key].to_i else ENV[transformed_key] end end end |
#make_compatible ⇒ Object
67 68 69 70 71 |
# File 'lib/ace/config.rb', line 67 def make_compatible # This function sets values used by Bolt that behave the same in ACE, but have a different meaning @data['file-server-uri'] = @data['puppet-server-uri'] @data['file-server-conn-timeout'] = @data['puppet-server-conn-timeout'] end |
#required_keys ⇒ Object
35 36 37 |
# File 'lib/ace/config.rb', line 35 def required_keys super + %w[puppet-server-uri cache-dir] end |
#service_name ⇒ Object
39 40 41 |
# File 'lib/ace/config.rb', line 39 def service_name 'ace-server' end |
#ssl_keys ⇒ Object
17 18 19 |
# File 'lib/ace/config.rb', line 17 def ssl_keys super + %w[ssl-ca-crls] end |
#validate ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/ace/config.rb', line 55 def validate super unless natural?(@data['concurrency']) raise Bolt::ValidationError, "Configured 'concurrency' must be a positive integer" end unless natural?(@data['puppet-server-conn-timeout']) raise Bolt::ValidationError, "Configured 'puppet-server-conn-timeout' must be a positive integer" end end |