{% for entry in taskserv.entries -%}
{{entry.domain}}:{{entry.port}} {
  {% if entry.file and entry.file != "" -%}
    file {{entry.file}}
    {% endif -%}
    {% if entry.forward and entry.forward.source != "" -%}
        {%- if entry.forward.forward_ip -%}
        {% set forward_ip=entry.forward.forward_ip %}
        {%- elif server.primary_dns -%}
        {% set forward_ip=server.primary_dns ~ " " ~ server.secondary_dns %}
        {%- else -%}
        {% set forward_ip="" %}
        {%- endif -%}
    {%- if forward_ip -%}
    forward {{entry.forward.source}} {{forward_ip}} {
    }
    {% endif -%}
    {% endif -%}
    {% if entry.use_log or entry.use_log == "true" -%}
        log
    {% endif -%}
    {% if entry.use_errors or entry.use_errors == "true" -%}
        errors
    {% endif -%}
    {% if entry.use_cache or entry.use_cache == "true" -%}
        cache
  {% endif -%}
}
{% endfor -%}
