Class: Invoker::Parsers::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/invoker/parsers/config.rb

Constant Summary collapse

PORT_REGEX =
/\$PORT/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename, port) ⇒ Config

Returns a new instance of Config.



9
10
11
12
13
14
15
16
# File 'lib/invoker/parsers/config.rb', line 9

def initialize(filename, port)
  @ini_content = File.read(filename)
  @port = port
  @processes = process_ini(@ini_content)
  if Invoker.can_run_balancer?
    @power_config = Invoker::Power::Config.load_config()
  end
end

Instance Attribute Details

#power_configObject

Returns the value of attribute power_config.



7
8
9
# File 'lib/invoker/parsers/config.rb', line 7

def power_config
  @power_config
end

#processesObject

Returns the value of attribute processes.



7
8
9
# File 'lib/invoker/parsers/config.rb', line 7

def processes
  @processes
end

Instance Method Details

#dns_portObject



22
23
24
# File 'lib/invoker/parsers/config.rb', line 22

def dns_port
  power_config && power_config.dns_port
end

#http_portObject



18
19
20
# File 'lib/invoker/parsers/config.rb', line 18

def http_port
  power_config && power_config.http_port
end

#process(label) ⇒ Object



26
27
28
29
30
# File 'lib/invoker/parsers/config.rb', line 26

def process(label)
  processes.detect {|pconfig|
    pconfig.label == label
  }
end