fix(entrypoint): only show passwd if generated

This commit is contained in:
Asif Bacchus 2021-05-12 20:55:55 -06:00
parent 0fb3dd427c
commit e4ea780a12
1 changed files with 5 additions and 1 deletions

View File

@ -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