{#   Copyright (c) 2015 Rackspace
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.
#
#}
# Configuration for loadbalancer {{ loadbalancer_id }}
global
    daemon
    user nobody
    log {{ log_http | default('/dev/log', true)}} local0
    log {{ log_server | default('/dev/log', true)}} local1 notice
    stats socket {{ sock_path }} mode 0666 level user
    {% if loadbalancer.global_connection_limit is defined %}
    maxconn {{ loadbalancer.global_connection_limit }}
    {% endif %}
    {% set found_ns = namespace(found=false) %}
    {% for pool in loadbalancer.listener.pools if pool.enabled %}
        {% if pool.health_monitor and pool.health_monitor.enabled and
              pool.health_monitor.type == constants.HEALTH_MONITOR_PING and
              found_ns.found == false %}
          {% set found_ns.found = true %}
    external-check
        {% endif %}
    {% endfor %}

defaults
    {% if connection_logging %}
    log global
    {% else %}
    no log
    {% endif %}
    retries 3
    option redispatch
    option splice-request
    option splice-response
    option http-keep-alive

{% block peers %}{% endblock peers %}

{% block proxies %}{% endblock proxies %}
