From d1f28d17bb0da8c5fe3a28c39ba618e1b9316897 Mon Sep 17 00:00:00 2001 From: Julian Foad Date: Wed, 3 Feb 2021 12:52:15 +0000 Subject: [PATCH] Allow psql args to be given to matrix-postgres-cli This passes any arguments given to 'matrix-postgres-cli' to the 'psql' command. Examples: $ # start an interactive shell connected to a given db $ sudo matrix-postgres-cli -d synapse $ # run a query, non-interactively $ sudo matrix-postgres-cli -d synapse -c 'SELECT group_id FROM groups;' --- .../templates/usr-local-bin/matrix-postgres-cli.j2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 61f4cf80..de09a4eb 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 @@ -9,4 +9,5 @@ docker run \ --env-file={{ matrix_postgres_base_path }}/env-postgres-psql \ --network {{ matrix_docker_network }} \ {{ matrix_postgres_docker_image_to_use }} \ - psql -h {{ matrix_postgres_connection_hostname }} + psql -h {{ matrix_postgres_connection_hostname }} \ + "$@"