Class: RuleInterface::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/rule-interface/configuartion.rb

Class Method Summary collapse

Class Method Details

.kiesever_configObject

Raises:



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/rule-interface/configuartion.rb', line 20

def kiesever_config
  return @kiesever_config if @cached

  @config_block.call(self) if @config_block

  @kiesever_config ||= {}

  @kiesever_config[:username] ||= ENV['KIE_SERVER_USERNAME'].presence
  @kiesever_config[:password] ||= ENV['KIE_SERVER_PASSWORD'].presence
  @kiesever_config[:hostname] ||= ENV['KIE_SERVER_HOSTNAME'].presence

  raise Error::ConfigError, 'KIE server username missing' if @kiesever_config[:username].blank?
  raise Error::ConfigError, 'KIE server password missing' if @kiesever_config[:password].blank?
  raise Error::ConfigError, 'KIE server hostname missing' if @kiesever_config[:hostname].blank?

  @cached = true

  @kiesever_config
end

.kiesever_config=(config) ⇒ Object

eg:

username: 'blah',
password: 'blah',
hostname: 'http://url'



15
16
17
18
# File 'lib/rule-interface/configuartion.rb', line 15

def kiesever_config=(config)
  @cached = false
  @kiesever_config = config
end

.setup(*args, &block) ⇒ Object



6
7
8
# File 'lib/rule-interface/configuartion.rb', line 6

def setup *args, &block
  @config_block = block
end