diff --git a/README.md b/README.md index 5b9adea2..6d30ffa3 100644 --- a/README.md +++ b/README.md @@ -194,6 +194,9 @@ Each hash in that section has the following options: * `name`: a human-readable name for the default server; must be unique * `host`: the host or IP address of the server * `port`: the port where the service runs on the `host` +* `backup` : boolean, use the server in backup mode +* `httpchk` : boolean, use haproxy httpchk for this server, requires `"option httpchk /"` to be set under haproxy options +* `chkport` : custom port for httpchk The `default_servers` list is used only when service discovery returns no servers. In that case, the service proxy will be created with the servers listed here. diff --git a/lib/synapse/haproxy.rb b/lib/synapse/haproxy.rb index 89c50077..f4ed4a37 100644 --- a/lib/synapse/haproxy.rb +++ b/lib/synapse/haproxy.rb @@ -717,7 +717,7 @@ def generate_backend_stanza(watcher, config) config.map {|c| "\t#{c}"}, backends.keys.shuffle.map {|backend_name| backend = backends[backend_name] - b = "\tserver #{backend_name} #{backend['host']}:#{backend['port']}" + b = "\tserver #{backend_name} #{backend['host']}:#{backend['port']}#{' backup' if backend['backup']}#{' check port ' if backend['httpchk']}#{backend['chkport']}" b = "#{b} cookie #{backend_name}" unless config.include?('mode tcp') b = "#{b} #{watcher.haproxy['server_options']}" b = "#{b} disabled" unless backend['enabled']