Allow using timeouts
diff --git a/README.rst b/README.rst
index 61c26f1..ac05317 100644
--- a/README.rst
+++ b/README.rst
@@ -49,10 +49,11 @@
enabled: True
mode: http/tcp
logging: syslog
- max_connections: 1024
- connect_timeout: 5000
- client_timeout: 50000
- server_timeout: 50000
+ maxconn: 1024
+ timeout:
+ connect: 5000
+ client: 50000
+ server: 50000
listens:
- name: https-in
bind:
@@ -77,10 +78,11 @@
enabled: True
mode: http/tcp
logging: syslog
- max_connections: 1024
- connect_timeout: 5000
- client_timeout: 50000
- server_timeout: 50000
+ maxconn: 1024
+ timeout:
+ connect: 5000
+ client: 50000
+ server: 50000
listens:
- name: https-in
bind:
diff --git a/haproxy/files/haproxy.cfg b/haproxy/files/haproxy.cfg
index c058232..ff0b75d 100644
--- a/haproxy/files/haproxy.cfg
+++ b/haproxy/files/haproxy.cfg
@@ -27,21 +27,17 @@
log global
mode http
- maxconn 8000
- {#
- timeout connect {{ proxy.get('connect_timeout', '5000') }}ms
- timeout client {{ proxy.get('client_timeout', '50000ms') }}ms
- timeout server {{ proxy.get('server_timeout', '50000ms') }}ms
- #}
+ maxconn {{ proxy.maxconn|default(8000) }}
option redispatch
- retries 3
+ retries {{ proxy.retries|default(3) }}
stats enable
- timeout http-request 10s
- timeout queue 1m
- timeout connect 10s
- timeout client 1m
- timeout server 1m
- timeout check 10s
+
+ timeout http-request {{ proxy.get('timeout', {}).get('http-request','10s') }}
+ timeout queue {{ proxy.get('timeout', {}).get('queue', '1m') }}
+ timeout connect {{ proxy.get('timeout', {}).get('connect', '10s') }}
+ timeout client {{ proxy.get('timeout', {}).get('client', '1m') }}
+ timeout server {{ proxy.get('timeout', {}).get('server', '1m') }}
+ timeout check {{ proxy.get('timeout', {}).get('check', '10s') }}
{%- if proxy.listen.admin_page is defined and proxy.listen.admin_page.user is defined %}
@@ -143,6 +139,9 @@
{# no type specified #}
mode {{ listen.mode|default('tcp') }}
balance {{ listen.balance|default('roundrobin') }}
+ {%- for ttype, timeout in listen.get('timeout', {}).iteritems() %}
+ timeout {{ ttype }} {{ timeout }}
+ {%- endfor %}
{%- for aclname, acl in listen.get('acl', {}).iteritems() %}
acl {{ aclname }} {{ acl }}
{%- endfor %}