global
    log 127.0.0.1   syslog info
    daemon
    maxconn 64000
    spread-checks 4
    stats socket /var/vcap/data/tcp_router/config/haproxy.sock user vcap group vcap mode 600 level operator expose-fd listeners
    ssl-default-bind-options ssl-min-ver TLSv1.2

defaults
    log global
    timeout connect 30000ms
    maxconn 64000
    <% if p("tcp_router.request_timeout_in_seconds").to_i > 0 %>
        timeout client <%= p("tcp_router.request_timeout_in_seconds").to_i * 1000 %>ms
        timeout server <%= p("tcp_router.request_timeout_in_seconds").to_i * 1000 %>ms
    <% end %>

<% if p("tcp_router.enable_nontls_health_checks") %>
listen health_check_http_url
    mode http
    bind :<%= p("tcp_router.health_check_port") %>
    monitor-uri /health
    monitor fail if { env(IS_DRAINING) -m str true }
<% end %>

listen health_check_https_url
    mode http
    bind :<%= p("tcp_router.tls_health_check_port") %> ssl crt /var/vcap/jobs/tcp_router/config/certs/health.pem
    monitor-uri /health
    monitor fail if { env(IS_DRAINING) -m str true }
