--- /dev/null
+{%- from "influxdb/map.jinja" import relay with context -%}
+
+{%- if relay.get('enabled') %}
+
+{%- for name, listen in relay.listen.iteritems()|sort %}
+
+{%- if listen.get('enabled', True) and listen.get('type', 'http') in ('http', 'udp') %}
+
+{%- set listen_type = listen.get('type', 'http') %}
+[[{{ listen_type }}]]
+name = "{{ name }}"
+bind-addr = "{{ listen.bind.get('address', '0.0.0.0') }}:{{ listen.bind.port }}"
+{%- if listen_type == 'http' and listen.default_retention_policy is defined %}
+default-retention-policy = "{{ listen.default_retention_policy }}"
+{%- endif %}
+{%- if listen_type == 'udp' and listen.precision is defined %}
+precision = "{{ listen.precision }}"
+{%- endif %}
+{%- if listen_type == 'udp' and listen.read_buffer is defined %}
+read-buffer = {{ listen.read_buffer|int }}
+{%- endif %}
+
+{%- set outputs = [] %}
+{%- for output_name, output in listen.get('output', {}).iteritems()|sort %}
+ {%- set tmp = ['name = "{}"'.format(output_name), 'location = "{}"'.format( output.location)] %}
+ {%- if listen_type == 'http' and output.timeout is defined %}
+ {%- do tmp.append('timeout = "{}"'.format(output.timeout)) %}
+ {%- endif %}
+ {%- if listen_type == 'http' and output.buffer_size_mb is defined %}
+ {%- do tmp.append('buffer-size-mb = {}'.format(output.buffer_size_mb)) %}
+ {%- endif %}
+ {%- if listen_type == 'http' and output.max_batch_kb is defined %}
+ {%- do tmp.append('max-batch-kb = {}'.format(output.max_batch_kb)) %}
+ {%- endif %}
+ {%- if listen_type == 'http' and output.max_delay_interval is defined %}
+ {%- do tmp.append('max-delay-interval = "{}"'.format(output.max_delay_interval)) %}
+ {%- endif %}
+ {%- if listen_type == 'udp' and output.mtu is defined %}
+ {%- do tmp.append('mtu = {}'.format(output.mtu)) %}
+ {%- endif %}
+ {%- do outputs.append(tmp) %}
+{%- endfor %}
+
+output = [
+{%- for output in outputs %}
+ { {{ output|join(', ') }} },
+{%- endfor %}
+]
+
+{%- endif %}
+
+{%- endfor %}
+
+{%- endif %}