From 74db3e66395ff97d4f5553c7cea9d29101851455 Mon Sep 17 00:00:00 2001 From: Peter Schiffer <3899107+pschiffe@users.noreply.github.com> Date: Fri, 3 Jan 2025 15:33:08 +0100 Subject: [PATCH] Add MYSQL_CLIENT_EXTRA_PARAMS env var So it's possible to set custom parameters for mysql client program. Fixes #147 --- pdns-mysql/docker-entrypoint.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pdns-mysql/docker-entrypoint.sh b/pdns-mysql/docker-entrypoint.sh index b75c24e..9f3a7ec 100755 --- a/pdns-mysql/docker-entrypoint.sh +++ b/pdns-mysql/docker-entrypoint.sh @@ -38,20 +38,20 @@ deriveMySQLSettingsFromEnvironment() { } generateMySQLCommand() { - EXTRA='' + : "${MYSQL_CLIENT_EXTRA_PARAMS:=}" # Password Auth - if [ "${PDNS_gmysql_password}" ]; then - EXTRA="${EXTRA} -p${PDNS_gmysql_password}" + if [ "${PDNS_gmysql_password:-}" ]; then + MYSQL_CLIENT_EXTRA_PARAMS="${MYSQL_CLIENT_EXTRA_PARAMS} -p${PDNS_gmysql_password}" fi # Allow socket connections if [ "${PDNS_gmysql_socket:-}" ]; then export PDNS_gmysql_host='localhost' - EXTRA="${EXTRA} --socket=${PDNS_gmysql_socket}" + MYSQL_CLIENT_EXTRA_PARAMS="${MYSQL_CLIENT_EXTRA_PARAMS} --socket=${PDNS_gmysql_socket}" fi - MYSQL_COMMAND="mariadb -h ${PDNS_gmysql_host} -P ${PDNS_gmysql_port} -u ${PDNS_gmysql_user}${EXTRA}" + MYSQL_COMMAND="mariadb -h ${PDNS_gmysql_host} -P ${PDNS_gmysql_port} -u ${PDNS_gmysql_user} ${MYSQL_CLIENT_EXTRA_PARAMS}" } createDatabaseIfRequested() {