Class: PlanExecutor::Config

Inherits:
BoltServer::BaseConfig show all
Defined in:
lib/plan_executor/config.rb

Instance Method Summary collapse

Methods inherited from BoltServer::BaseConfig

#[], #env_keys, #initialize, #load_file_config, #natural?, #ssl_keys

Constructor Details

This class inherits a constructor from BoltServer::BaseConfig

Instance Method Details

#config_keysObject



9
10
11
# File 'lib/plan_executor/config.rb', line 9

def config_keys
  super + %w[modulepath workers orchestrator-url]
end

#defaultsObject



13
14
15
16
17
18
# File 'lib/plan_executor/config.rb', line 13

def defaults
  super.merge(
    'port' => 62659,
    'workers' => 1
  )
end

#load_env_configObject



28
29
30
31
32
33
34
# File 'lib/plan_executor/config.rb', line 28

def load_env_config
  env_keys.each do |key|
    transformed_key = "BOLT_#{key.tr('-', '_').upcase}"
    next unless ENV.key?(transformed_key)
    @data[key] = ENV[transformed_key]
  end
end

#required_keysObject



24
25
26
# File 'lib/plan_executor/config.rb', line 24

def required_keys
  super + ['orchestrator-url']
end

#service_nameObject



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

def service_name
  'plan-executor'
end

#validateObject



36
37
38
39
40
41
# File 'lib/plan_executor/config.rb', line 36

def validate
  super
  unless natural?(@data['workers'])
    raise Bolt::ValidationError, "Configured 'workers' must be a positive integer"
  end
end