From 36f0a70813b5c9e7fbbcd884b5fa330401c00448 Mon Sep 17 00:00:00 2001 From: Andreas Thienemann Date: Sat, 29 Sep 2018 03:42:32 +0200 Subject: [PATCH] Improve handling of multiple values in main.cf In case a list of items (iterable) is passed to the set_parameter function in main.cf, the list of items are joined by a comma. This makes parameters with many items a bit hard to read as it results in long lines. Postfix also supports an alternative declaration where subsequent parameter values are written in a new line that starts with whitespace and thus forms a continuation of the previous line. This makes parsing multiple entry lines easier for humans. Old style: smtpd_milters = { unix:/run/spamass-milter/postfix/sock, connect_timeout=10s, default_action=accept } { inet:localhost:10003, connect_timeout=10s, default_action=accept } { inet:localhost:10004, connect_timeout=10s, default_action=accept } { inet:localhost:10006, connect_timeout=10s, default_action=accept } { inet:localhost:10007, connect_timeout=10s, default_action=accept } New style: smtpd_milters = { unix:/run/spamass-milter/postfix/sock, connect_timeout=10s, default_action=accept } { inet:localhost:10003, connect_timeout=10s, default_action=accept } { inet:localhost:10004, connect_timeout=10s, default_action=accept } { inet:localhost:10006, connect_timeout=10s, default_action=accept } { inet:localhost:10007, connect_timeout=10s, default_action=accept } --- postfix/files/main.cf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postfix/files/main.cf b/postfix/files/main.cf index 48dc59b..b8e0367 100644 --- a/postfix/files/main.cf +++ b/postfix/files/main.cf @@ -19,7 +19,7 @@ {%- if value is number or value is string -%} {{ parameter }} = {{ value }} {%- elif value is iterable -%} -{{ parameter }} = {{ value | join(', ')}} +{{ parameter }} = {{ value | join('\n') | indent(parameter | length + 3) }} {%- endif -%} {%- do processed_parameters.append(parameter) %} {%- endif %}