Module: HAProxy::ServerList
Overview
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.
Instance Method Summary collapse
Instance Method Details
#add_server(name, host, options) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/haproxy/config.rb', line 12 def add_server(name, host, ) ||= {} new_server = [:template] ? [:template].clone : Server.new new_server.name = name new_server.host = host new_server.port = [:port] if [:port] new_server.attributes ||= [:attributes] || [] self.servers[name] = new_server new_server end |