module HAProxy::ServerList

Contains shared methods for config objects that contain a list of servers. The including class is expected to have an instance variable called :servers that contains a hash of server configurations.

Public Instance Methods

add_server(name, host, options) click to toggle source
# File lib/haproxy/config.rb, line 14
def add_server(name, host, options)
  options ||= {}
  new_server = options[:template] ? options[:template].clone : Server.new
  new_server.name       = name
  new_server.host       = host
  new_server.port       = options[:port] if options[:port]
  new_server.attributes ||= options[:attributes] || {}
  servers[name] = new_server
  new_server
end