From 491872bd463fbd61326f00fe7f39bc35b5cf6128 Mon Sep 17 00:00:00 2001 From: "Raphael P. Ribeiro" Date: Mon, 17 Aug 2020 17:16:34 -0300 Subject: [PATCH] check variable definitions to avoid errors --- templates/pgbouncer.ini.j2 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/templates/pgbouncer.ini.j2 b/templates/pgbouncer.ini.j2 index 5dcc5bf..db8ecc1 100644 --- a/templates/pgbouncer.ini.j2 +++ b/templates/pgbouncer.ini.j2 @@ -1,3 +1,5 @@ +#jinja2: trim_blocks: True + [pgbouncer] logfile = {{ pgbouncer_log_file }} pidfile = {{ pgbouncer_pid_file }} @@ -30,5 +32,6 @@ stats_users = {{ pgbouncer_stats_users|join(",") }} {% if database.comment is defined %} # {{ database.comment }} {% endif %} -{{ database.name }} = host={{ database.host }} dbname={{ database.dbname }} client_encoding={{ database.encoding }} auth_user={{ database.auth_user }} +{{ database.name }} = host={{ database.host }} {%- if database.dbname is defined %} dbname={{ database.dbname }} {%- endif %} {%- if database.client_encoding is defined %} client_encoding={{ database.client_encoding }} {%- endif %} {%- if database.auth_user is defined %} auth_user={{ database.auth_user }} {%- endif %} + {% endfor %}