From e4ea780a1278dd6fc3a54f706bb67eb7c573fc77 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Wed, 12 May 2021 20:55:55 -0600 Subject: [PATCH] fix(entrypoint): only show passwd if generated --- entrypoint.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index ae54237..d1efa4a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -19,6 +19,7 @@ isInt () { # instantiate variables sqlCmd='/tmp/cmd.sql' +showRootPassword=0 # convert env variables to uppercase for proper string comparison MYSQL_SKIP_NAME_RESOLVE=$(convertCase "$MYSQL_SKIP_NAME_RESOLVE") @@ -48,6 +49,7 @@ fi if [ -z "$MYSQL_ROOT_PASSWORD" ]; then MYSQL_ROOT_PASSWORD="$( head /dev/urandom | tr -dc A-Za-z0-9 | head -c32 )" export MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD + showRootPassword=1 fi # change mysql UID & GID @@ -159,7 +161,9 @@ done # note initialization complete and display root password printf "\nInitialization complete...\n" -printf "(mySQL root password: %s)\n\n" "$MYSQL_ROOT_PASSWORD" +if [ "$showRootPassword" -eq 1 ]; then + printf "(mySQL root password: %s)\n\n" "$MYSQL_ROOT_PASSWORD" +fi # process CMD sent to this container case "$1" in