feat: implement list_address_port_tls and parent_address_port_tls macros
- Add list_address_port_tls macro for rendering address lists with port and tls parameters - Add parent_address_port_tls macro for parent statements with global port/tls - Follow existing naming pattern with separate list_ and parent_ macros - Supports forwarders, primaries, and similar blocks with port/tls grammar
This commit is contained in:
@@ -110,4 +110,36 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
{{ name }} "{{ value }}";
|
{{ name }} "{{ value }}";
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% macro list_address_port_tls(dict, indent=bind9_config_indent) %}
|
||||||
|
{# This macro is for use for statements with grammar like #}
|
||||||
|
{# address port 00 tls str; address port 00 tls str; #}
|
||||||
|
{# it is usually called by a parent macro #}
|
||||||
|
{% filter indent(indent, true) %}
|
||||||
|
{% for item in dict %}
|
||||||
|
{% if item is not mapping %}
|
||||||
|
{{ item }};
|
||||||
|
{% else %}
|
||||||
|
{{ item.address }}
|
||||||
|
{{- (' port ' + item.port | string) if item.port is defined and item.port -}}
|
||||||
|
{{- (' tls ' + item.tls | string) if item.tls is defined and item.tls -}};
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endfilter %}
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% macro parent_address_port_tls(name, dict) %}
|
||||||
|
{# This macro is for use for statements with grammar like #}
|
||||||
|
{# statement port 00 tls str { address port 00 tls str; address port 00 tls str; } #}
|
||||||
|
{# the list inside the statement is handled by list_address_port_tls #}
|
||||||
|
{% if dict is not mapping and dict is iterable %}
|
||||||
|
{{ name }} {
|
||||||
|
{{ list_address_port_tls(dict) }}};
|
||||||
|
{% else %}
|
||||||
|
{{ name }}
|
||||||
|
{{- (' port ' + dict.port | string) if dict.port is defined and dict.port -}}
|
||||||
|
{{- (' tls ' + dict.tls | string) if dict.tls is defined and dict.tls }} {
|
||||||
|
{{ list_address_port_tls(dict.addresses) }}};
|
||||||
|
{% endif %}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
Reference in New Issue
Block a user