|
- {%- macro output(key, value) -%}
- {%- if key in ['Address', 'DNS', 'AllowedIPs'] -%}
- {{output_list(key, value)}}
- {%- else -%}
- {{key}} = {{value}}
- {%- endif -%}
- {%- endmacro -%}
- {%- macro output_list(key, value) -%}
- {%- if value is string -%}
- {{key}} = {{value}}
- {%- else -%}
- {%- for item in value %}
- {{key}} = {{item}}
- {%- endfor -%}
- {%- endif -%}
- {%- endmacro -%}
- [Interface]
- {% for key, value in interface.items() -%}
- {{ output(key, value) }}
- {% endfor -%}
- {%- for peer in peers -%}
- [Peer]
- {% for key, value in peer.items() -%}
- {{ output(key, value) }}
- {% endfor -%}
- {%- endfor -%}
|