module HareDo::Config

Public Instance Methods

connectBroker() click to toggle source

Connect to the RabbitMQ broker

@return Return a client instance if connection was successful, nil otherwise

# File src/lib/haredo/config.rb, line 32
def connectBroker()

  account = @config['system']['broker']

  params = {
    :user     => account['user'],
    :password => account['password'],
    :host     => account['host'],
    :port     => account['port'], 
    :vhost    => account['vhost'],
    :ssl      => account['ssl']
  }

  peer = HareDo::Peer.new()
  
  peer.connect(params)

  return peer
end
loadConfig(file=nil) click to toggle source
# File src/lib/haredo/config.rb, line 16
def loadConfig(file=nil)
  @config_file = file || $haredo_default_config_file || HAREDO_DEFAULT_CONFIG_FILE    
  @config      = []    
  @config      = YAML.load_file(@config_file)
  @pid_file    = $haredo_default_pid_file || HAREDO_DEFAULT_PID_FILE
end
saveConfig() click to toggle source
# File src/lib/haredo/config.rb, line 23
def saveConfig()
  file = File.open(@config_file, 'w')
  file.write(YAML::dump(@config))
  file.close()
end