From c451025134c63b429a5853a7d77e7b2f3736fd14 Mon Sep 17 00:00:00 2001 From: Hugues De Keyzer Date: Tue, 7 May 2019 21:23:35 +0200 Subject: [PATCH] Fix indentation in templates Use Jinja2 lstrip_blocks option in templates to ensure consistent indentation in generated files. --- .../templates/static-files/well-known/matrix-client.j2 | 1 + .../templates/static-files/well-known/matrix-server.j2 | 1 + roles/matrix-base/templates/usr-local-bin/matrix-remove-all.j2 | 1 + roles/matrix-corporal/templates/config.json.j2 | 1 + .../matrix-corporal/templates/systemd/matrix-corporal.service.j2 | 1 + roles/matrix-coturn/templates/systemd/matrix-coturn.service.j2 | 1 + roles/matrix-coturn/templates/turnserver.conf.j2 | 1 + .../templates/systemd/matrix-dimension.service.j2 | 1 + roles/matrix-mailer/templates/env-mailer.j2 | 1 + roles/matrix-mailer/templates/systemd/matrix-mailer.service.j2 | 1 + roles/matrix-mxisd/templates/systemd/matrix-mxisd.service.j2 | 1 + .../templates/nginx/conf.d/matrix-dimension.conf.j2 | 1 + .../templates/nginx/conf.d/matrix-domain.conf.j2 | 1 + .../templates/nginx/conf.d/matrix-riot-web.conf.j2 | 1 + .../templates/nginx/conf.d/matrix-synapse.conf.j2 | 1 + .../matrix-nginx-proxy/templates/nginx/conf.d/nginx-http.conf.j2 | 1 + .../templates/nginx/matrix-synapse-metrics-htpasswd.j2 | 1 + roles/matrix-nginx-proxy/templates/nginx/nginx.conf.j2 | 1 + .../templates/systemd/matrix-nginx-proxy.service.j2 | 1 + .../usr-local-bin/matrix-ssl-lets-encrypt-certificates-renew.j2 | 1 + roles/matrix-postgres/templates/env-postgres-psql.j2 | 1 + roles/matrix-postgres/templates/env-postgres-server.j2 | 1 + .../matrix-postgres/templates/systemd/matrix-postgres.service.j2 | 1 + .../templates/usr-local-bin/matrix-make-user-admin.j2 | 1 + .../templates/usr-local-bin/matrix-postgres-cli.j2 | 1 + .../usr-local-bin/matrix-postgres-update-user-password-hash.j2 | 1 + roles/matrix-riot-web/templates/config.json.j2 | 1 + roles/matrix-riot-web/templates/nginx.conf.j2 | 1 + .../matrix-riot-web/templates/systemd/matrix-riot-web.service.j2 | 1 + roles/matrix-riot-web/templates/welcome.html.j2 | 1 + .../systemd/matrix-appservice-discord.service.j2 | 1 + .../ext/appservice-irc/systemd/matrix-appservice-irc.service.j2 | 1 + .../matrix-synapse/templates/ext/mautrix-telegram/config.yaml.j2 | 1 + .../mautrix-telegram/systemd/matrix-mautrix-telegram.service.j2 | 1 + .../matrix-synapse/templates/ext/mautrix-whatsapp/config.yaml.j2 | 1 + .../mautrix-whatsapp/systemd/matrix-mautrix-whatsapp.service.j2 | 1 + roles/matrix-synapse/templates/goofys/env-goofys.j2 | 1 + .../templates/goofys/systemd/matrix-goofys.service.j2 | 1 + roles/matrix-synapse/templates/synapse/env-synapse.j2 | 1 + roles/matrix-synapse/templates/synapse/homeserver.yaml.j2 | 1 + roles/matrix-synapse/templates/synapse/synapse.log.config.j2 | 1 + .../templates/synapse/systemd/matrix-synapse.service.j2 | 1 + .../synapse/usr-local-bin/matrix-synapse-register-user.j2 | 1 + 43 files changed, 43 insertions(+) diff --git a/roles/matrix-base/templates/static-files/well-known/matrix-client.j2 b/roles/matrix-base/templates/static-files/well-known/matrix-client.j2 index e3b0d767..120f9c97 100644 --- a/roles/matrix-base/templates/static-files/well-known/matrix-client.j2 +++ b/roles/matrix-base/templates/static-files/well-known/matrix-client.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" { "m.homeserver": { "base_url": "{{ matrix_homeserver_url }}" diff --git a/roles/matrix-base/templates/static-files/well-known/matrix-server.j2 b/roles/matrix-base/templates/static-files/well-known/matrix-server.j2 index a8e19167..de0f5722 100644 --- a/roles/matrix-base/templates/static-files/well-known/matrix-server.j2 +++ b/roles/matrix-base/templates/static-files/well-known/matrix-server.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" { "m.server": "{{ matrix_server_fqn_matrix }}:8448" } diff --git a/roles/matrix-base/templates/usr-local-bin/matrix-remove-all.j2 b/roles/matrix-base/templates/usr-local-bin/matrix-remove-all.j2 index 9fad37d9..ac810595 100644 --- a/roles/matrix-base/templates/usr-local-bin/matrix-remove-all.j2 +++ b/roles/matrix-base/templates/usr-local-bin/matrix-remove-all.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" #!/bin/bash if [ "$(id -u)" != "0" ]; then diff --git a/roles/matrix-corporal/templates/config.json.j2 b/roles/matrix-corporal/templates/config.json.j2 index 378b2c19..e2333bcc 100644 --- a/roles/matrix-corporal/templates/config.json.j2 +++ b/roles/matrix-corporal/templates/config.json.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" { "Matrix": { "HomeserverDomainName": "{{ matrix_corporal_matrix_homeserver_domain_name }}", diff --git a/roles/matrix-corporal/templates/systemd/matrix-corporal.service.j2 b/roles/matrix-corporal/templates/systemd/matrix-corporal.service.j2 index d0adbf9d..74de9680 100644 --- a/roles/matrix-corporal/templates/systemd/matrix-corporal.service.j2 +++ b/roles/matrix-corporal/templates/systemd/matrix-corporal.service.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" [Unit] Description=Matrix Corporal {% for service in matrix_corporal_systemd_required_services_list %} diff --git a/roles/matrix-coturn/templates/systemd/matrix-coturn.service.j2 b/roles/matrix-coturn/templates/systemd/matrix-coturn.service.j2 index c1f00789..e288c0e5 100644 --- a/roles/matrix-coturn/templates/systemd/matrix-coturn.service.j2 +++ b/roles/matrix-coturn/templates/systemd/matrix-coturn.service.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" [Unit] Description=Matrix Coturn server {% for service in matrix_coturn_systemd_required_services_list %} diff --git a/roles/matrix-coturn/templates/turnserver.conf.j2 b/roles/matrix-coturn/templates/turnserver.conf.j2 index 2bf7649c..3fcf0b67 100644 --- a/roles/matrix-coturn/templates/turnserver.conf.j2 +++ b/roles/matrix-coturn/templates/turnserver.conf.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" use-auth-secret static-auth-secret={{ matrix_coturn_turn_static_auth_secret }} realm=turn.{{ matrix_server_fqn_matrix }} diff --git a/roles/matrix-dimension/templates/systemd/matrix-dimension.service.j2 b/roles/matrix-dimension/templates/systemd/matrix-dimension.service.j2 index c176b3e7..bd04be18 100644 --- a/roles/matrix-dimension/templates/systemd/matrix-dimension.service.j2 +++ b/roles/matrix-dimension/templates/systemd/matrix-dimension.service.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" [Unit] Description=Matrix Dimension After=docker.service diff --git a/roles/matrix-mailer/templates/env-mailer.j2 b/roles/matrix-mailer/templates/env-mailer.j2 index 7765b8f9..180bc500 100644 --- a/roles/matrix-mailer/templates/env-mailer.j2 +++ b/roles/matrix-mailer/templates/env-mailer.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" {% if matrix_mailer_relay_use %} SMARTHOST={{ matrix_mailer_relay_host_name }}::{{ matrix_mailer_relay_host_port }} {% endif %} diff --git a/roles/matrix-mailer/templates/systemd/matrix-mailer.service.j2 b/roles/matrix-mailer/templates/systemd/matrix-mailer.service.j2 index de07a687..9b07f6c7 100644 --- a/roles/matrix-mailer/templates/systemd/matrix-mailer.service.j2 +++ b/roles/matrix-mailer/templates/systemd/matrix-mailer.service.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" [Unit] Description=Matrix mailer After=docker.service diff --git a/roles/matrix-mxisd/templates/systemd/matrix-mxisd.service.j2 b/roles/matrix-mxisd/templates/systemd/matrix-mxisd.service.j2 index 6d951643..d30ba718 100644 --- a/roles/matrix-mxisd/templates/systemd/matrix-mxisd.service.j2 +++ b/roles/matrix-mxisd/templates/systemd/matrix-mxisd.service.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" [Unit] Description=Matrix mxisd Identity server {% for service in matrix_mxisd_systemd_required_services_list %} diff --git a/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-dimension.conf.j2 b/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-dimension.conf.j2 index 1886496b..dbfe96ce 100644 --- a/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-dimension.conf.j2 +++ b/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-dimension.conf.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" server { listen {{ 8080 if matrix_nginx_proxy_enabled else 80 }}; server_name {{ matrix_nginx_proxy_proxy_dimension_hostname }}; diff --git a/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-domain.conf.j2 b/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-domain.conf.j2 index 679f3efa..0d234827 100644 --- a/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-domain.conf.j2 +++ b/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-domain.conf.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" server { listen {{ 8080 if matrix_nginx_proxy_enabled else 80 }}; server_name {{ matrix_nginx_proxy_base_domain_hostname }}; diff --git a/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-riot-web.conf.j2 b/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-riot-web.conf.j2 index 661a5f31..4a97ebfa 100644 --- a/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-riot-web.conf.j2 +++ b/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-riot-web.conf.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" server { listen {{ 8080 if matrix_nginx_proxy_enabled else 80 }}; server_name {{ matrix_nginx_proxy_proxy_riot_hostname }}; diff --git a/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-synapse.conf.j2 b/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-synapse.conf.j2 index 00e7a1be..8298a4d5 100644 --- a/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-synapse.conf.j2 +++ b/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-synapse.conf.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" server { listen {{ 8080 if matrix_nginx_proxy_enabled else 80 }}; server_name {{ matrix_nginx_proxy_proxy_matrix_hostname }}; diff --git a/roles/matrix-nginx-proxy/templates/nginx/conf.d/nginx-http.conf.j2 b/roles/matrix-nginx-proxy/templates/nginx/conf.d/nginx-http.conf.j2 index ed171cfa..290e1a98 100644 --- a/roles/matrix-nginx-proxy/templates/nginx/conf.d/nginx-http.conf.j2 +++ b/roles/matrix-nginx-proxy/templates/nginx/conf.d/nginx-http.conf.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" # The default is aligned to the CPU's cache size, # which can sometimes be too low to handle our 2 vhosts (Synapse and Riot). # diff --git a/roles/matrix-nginx-proxy/templates/nginx/matrix-synapse-metrics-htpasswd.j2 b/roles/matrix-nginx-proxy/templates/nginx/matrix-synapse-metrics-htpasswd.j2 index 27cf298f..1a7247ac 100644 --- a/roles/matrix-nginx-proxy/templates/nginx/matrix-synapse-metrics-htpasswd.j2 +++ b/roles/matrix-nginx-proxy/templates/nginx/matrix-synapse-metrics-htpasswd.j2 @@ -1,2 +1,3 @@ +#jinja2: lstrip_blocks: "True" # User and password for protecting /_synapse/metrics URI prometheus:{{ matrix_nginx_proxy_proxy_synapse_metrics_basic_auth_key }} diff --git a/roles/matrix-nginx-proxy/templates/nginx/nginx.conf.j2 b/roles/matrix-nginx-proxy/templates/nginx/nginx.conf.j2 index 3382d6c6..51aa8a00 100644 --- a/roles/matrix-nginx-proxy/templates/nginx/nginx.conf.j2 +++ b/roles/matrix-nginx-proxy/templates/nginx/nginx.conf.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" # This is a custom nginx configuration file that we use in the container (instead of the default one), # because it allows us to run nginx with a non-root user. # diff --git a/roles/matrix-nginx-proxy/templates/systemd/matrix-nginx-proxy.service.j2 b/roles/matrix-nginx-proxy/templates/systemd/matrix-nginx-proxy.service.j2 index d3cf4044..1a154c0d 100644 --- a/roles/matrix-nginx-proxy/templates/systemd/matrix-nginx-proxy.service.j2 +++ b/roles/matrix-nginx-proxy/templates/systemd/matrix-nginx-proxy.service.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" [Unit] Description=Matrix nginx-proxy server {% for service in matrix_nginx_proxy_systemd_required_services_list %} diff --git a/roles/matrix-nginx-proxy/templates/usr-local-bin/matrix-ssl-lets-encrypt-certificates-renew.j2 b/roles/matrix-nginx-proxy/templates/usr-local-bin/matrix-ssl-lets-encrypt-certificates-renew.j2 index 7e561017..93306d78 100644 --- a/roles/matrix-nginx-proxy/templates/usr-local-bin/matrix-ssl-lets-encrypt-certificates-renew.j2 +++ b/roles/matrix-nginx-proxy/templates/usr-local-bin/matrix-ssl-lets-encrypt-certificates-renew.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" #!/bin/bash # For renewal to work, matrix-nginx-proxy (or another webserver, if matrix-nginx-proxy is disabled) diff --git a/roles/matrix-postgres/templates/env-postgres-psql.j2 b/roles/matrix-postgres/templates/env-postgres-psql.j2 index c503450a..c61927a3 100644 --- a/roles/matrix-postgres/templates/env-postgres-psql.j2 +++ b/roles/matrix-postgres/templates/env-postgres-psql.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" PGUSER={{ matrix_postgres_connection_username }} PGPASSWORD={{ matrix_postgres_connection_password }} PGDATABASE={{ matrix_postgres_db_name }} \ No newline at end of file diff --git a/roles/matrix-postgres/templates/env-postgres-server.j2 b/roles/matrix-postgres/templates/env-postgres-server.j2 index f9ff4dc3..34f75aee 100644 --- a/roles/matrix-postgres/templates/env-postgres-server.j2 +++ b/roles/matrix-postgres/templates/env-postgres-server.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" POSTGRES_USER={{ matrix_postgres_connection_username }} POSTGRES_PASSWORD={{ matrix_postgres_connection_password }} POSTGRES_DB={{ matrix_postgres_db_name }} \ No newline at end of file diff --git a/roles/matrix-postgres/templates/systemd/matrix-postgres.service.j2 b/roles/matrix-postgres/templates/systemd/matrix-postgres.service.j2 index 14321efd..2d1c9118 100644 --- a/roles/matrix-postgres/templates/systemd/matrix-postgres.service.j2 +++ b/roles/matrix-postgres/templates/systemd/matrix-postgres.service.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" [Unit] Description=Matrix Postgres server After=docker.service diff --git a/roles/matrix-postgres/templates/usr-local-bin/matrix-make-user-admin.j2 b/roles/matrix-postgres/templates/usr-local-bin/matrix-make-user-admin.j2 index 20f9fda2..f8daa6a7 100644 --- a/roles/matrix-postgres/templates/usr-local-bin/matrix-make-user-admin.j2 +++ b/roles/matrix-postgres/templates/usr-local-bin/matrix-make-user-admin.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" #!/bin/bash if [ $# -ne 1 ]; then diff --git a/roles/matrix-postgres/templates/usr-local-bin/matrix-postgres-cli.j2 b/roles/matrix-postgres/templates/usr-local-bin/matrix-postgres-cli.j2 index 34836629..8f0c4c5b 100644 --- a/roles/matrix-postgres/templates/usr-local-bin/matrix-postgres-cli.j2 +++ b/roles/matrix-postgres/templates/usr-local-bin/matrix-postgres-cli.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" #!/bin/bash docker run \ diff --git a/roles/matrix-postgres/templates/usr-local-bin/matrix-postgres-update-user-password-hash.j2 b/roles/matrix-postgres/templates/usr-local-bin/matrix-postgres-update-user-password-hash.j2 index bd99211c..d950ce97 100644 --- a/roles/matrix-postgres/templates/usr-local-bin/matrix-postgres-update-user-password-hash.j2 +++ b/roles/matrix-postgres/templates/usr-local-bin/matrix-postgres-update-user-password-hash.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" #!/bin/bash if [ $# -ne 2 ]; then diff --git a/roles/matrix-riot-web/templates/config.json.j2 b/roles/matrix-riot-web/templates/config.json.j2 index 0179cc35..92753a15 100644 --- a/roles/matrix-riot-web/templates/config.json.j2 +++ b/roles/matrix-riot-web/templates/config.json.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" { "default_hs_url": {{ matrix_riot_web_default_hs_url|string|to_json }}, "default_is_url": {{ matrix_riot_web_default_is_url|string|to_json }}, diff --git a/roles/matrix-riot-web/templates/nginx.conf.j2 b/roles/matrix-riot-web/templates/nginx.conf.j2 index 84789954..fba16bbd 100644 --- a/roles/matrix-riot-web/templates/nginx.conf.j2 +++ b/roles/matrix-riot-web/templates/nginx.conf.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" # This is a custom nginx configuration file that we use in the container (instead of the default one), # because it allows us to run nginx with a non-root user. # diff --git a/roles/matrix-riot-web/templates/systemd/matrix-riot-web.service.j2 b/roles/matrix-riot-web/templates/systemd/matrix-riot-web.service.j2 index a270e0e3..63a6c7a6 100644 --- a/roles/matrix-riot-web/templates/systemd/matrix-riot-web.service.j2 +++ b/roles/matrix-riot-web/templates/systemd/matrix-riot-web.service.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True" [Unit] Description=Matrix riot-web server {% for service in matrix_riot_web_systemd_required_services_list %} diff --git a/roles/matrix-riot-web/templates/welcome.html.j2 b/roles/matrix-riot-web/templates/welcome.html.j2 index 6456e947..319f9795 100644 --- a/roles/matrix-riot-web/templates/welcome.html.j2 +++ b/roles/matrix-riot-web/templates/welcome.html.j2 @@ -1,3 +1,4 @@ +#jinja2: lstrip_blocks: "True"