Browse Source

simplify and fix wg.conf output() macros

tags/v2.1^0
Maximilian Eschenbacher 5 years ago
parent
commit
be1f11f32f
1 changed files with 3 additions and 8 deletions
  1. +3
    -8
      wireguard/files/wg.conf

+ 3
- 8
wireguard/files/wg.conf View File

@@ -1,17 +1,12 @@
{%- 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 -%}
{%- elif value is iterable -%}
{%- for item in value %}
{{key}} = {{item}}
{%- endfor -%}
{%- else -%}
{{key}} = {{value}}
{%- endif -%}
{%- endmacro -%}
[Interface]

Loading…
Cancel
Save