From dab00d0bd5e42888be74eb628274960122cc44c4 Mon Sep 17 00:00:00 2001 From: frank Date: Thu, 24 Aug 2017 00:48:48 +0300 Subject: [PATCH] Allows for empty mysql root passwords as requested in https://github.com/joomla/docker-joomla/issues/23. just omit the `JOOMLA_DB_PASSWORD` environment variable and instead add `JOOMLA_DB_PASSWORD_ALLOW_EMPTY=yes`. --- apache-php7/docker-entrypoint.sh | 4 ++-- apache/docker-entrypoint.sh | 4 ++-- docker-entrypoint.sh | 4 ++-- fpm-php7/docker-entrypoint.sh | 4 ++-- fpm/docker-entrypoint.sh | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/apache-php7/docker-entrypoint.sh b/apache-php7/docker-entrypoint.sh index 0f1acae..0dc97b1 100755 --- a/apache-php7/docker-entrypoint.sh +++ b/apache-php7/docker-entrypoint.sh @@ -22,12 +22,12 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then # If the DB user is 'root' then use the MySQL root password env var : ${JOOMLA_DB_USER:=root} - if [ "$JOOMLA_DB_USER" = 'root' ]; then + if [ "$JOOMLA_DB_USER" = 'root' ] && [ "$JOOMLA_DB_PASSWORD_ALLOW_EMPTY" != 'yes' ]; then : ${JOOMLA_DB_PASSWORD:=$MYSQL_ENV_MYSQL_ROOT_PASSWORD} fi : ${JOOMLA_DB_NAME:=joomla} - if [ -z "$JOOMLA_DB_PASSWORD" ]; then + if [ -z "$JOOMLA_DB_PASSWORD" ] && [ "$JOOMLA_DB_PASSWORD_ALLOW_EMPTY" != 'yes' ]; then echo >&2 "error: missing required JOOMLA_DB_PASSWORD environment variable" echo >&2 " Did you forget to -e JOOMLA_DB_PASSWORD=... ?" echo >&2 diff --git a/apache/docker-entrypoint.sh b/apache/docker-entrypoint.sh index 0f1acae..0dc97b1 100755 --- a/apache/docker-entrypoint.sh +++ b/apache/docker-entrypoint.sh @@ -22,12 +22,12 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then # If the DB user is 'root' then use the MySQL root password env var : ${JOOMLA_DB_USER:=root} - if [ "$JOOMLA_DB_USER" = 'root' ]; then + if [ "$JOOMLA_DB_USER" = 'root' ] && [ "$JOOMLA_DB_PASSWORD_ALLOW_EMPTY" != 'yes' ]; then : ${JOOMLA_DB_PASSWORD:=$MYSQL_ENV_MYSQL_ROOT_PASSWORD} fi : ${JOOMLA_DB_NAME:=joomla} - if [ -z "$JOOMLA_DB_PASSWORD" ]; then + if [ -z "$JOOMLA_DB_PASSWORD" ] && [ "$JOOMLA_DB_PASSWORD_ALLOW_EMPTY" != 'yes' ]; then echo >&2 "error: missing required JOOMLA_DB_PASSWORD environment variable" echo >&2 " Did you forget to -e JOOMLA_DB_PASSWORD=... ?" echo >&2 diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 0f1acae..0dc97b1 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -22,12 +22,12 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then # If the DB user is 'root' then use the MySQL root password env var : ${JOOMLA_DB_USER:=root} - if [ "$JOOMLA_DB_USER" = 'root' ]; then + if [ "$JOOMLA_DB_USER" = 'root' ] && [ "$JOOMLA_DB_PASSWORD_ALLOW_EMPTY" != 'yes' ]; then : ${JOOMLA_DB_PASSWORD:=$MYSQL_ENV_MYSQL_ROOT_PASSWORD} fi : ${JOOMLA_DB_NAME:=joomla} - if [ -z "$JOOMLA_DB_PASSWORD" ]; then + if [ -z "$JOOMLA_DB_PASSWORD" ] && [ "$JOOMLA_DB_PASSWORD_ALLOW_EMPTY" != 'yes' ]; then echo >&2 "error: missing required JOOMLA_DB_PASSWORD environment variable" echo >&2 " Did you forget to -e JOOMLA_DB_PASSWORD=... ?" echo >&2 diff --git a/fpm-php7/docker-entrypoint.sh b/fpm-php7/docker-entrypoint.sh index 0f1acae..0dc97b1 100755 --- a/fpm-php7/docker-entrypoint.sh +++ b/fpm-php7/docker-entrypoint.sh @@ -22,12 +22,12 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then # If the DB user is 'root' then use the MySQL root password env var : ${JOOMLA_DB_USER:=root} - if [ "$JOOMLA_DB_USER" = 'root' ]; then + if [ "$JOOMLA_DB_USER" = 'root' ] && [ "$JOOMLA_DB_PASSWORD_ALLOW_EMPTY" != 'yes' ]; then : ${JOOMLA_DB_PASSWORD:=$MYSQL_ENV_MYSQL_ROOT_PASSWORD} fi : ${JOOMLA_DB_NAME:=joomla} - if [ -z "$JOOMLA_DB_PASSWORD" ]; then + if [ -z "$JOOMLA_DB_PASSWORD" ] && [ "$JOOMLA_DB_PASSWORD_ALLOW_EMPTY" != 'yes' ]; then echo >&2 "error: missing required JOOMLA_DB_PASSWORD environment variable" echo >&2 " Did you forget to -e JOOMLA_DB_PASSWORD=... ?" echo >&2 diff --git a/fpm/docker-entrypoint.sh b/fpm/docker-entrypoint.sh index 0f1acae..0dc97b1 100755 --- a/fpm/docker-entrypoint.sh +++ b/fpm/docker-entrypoint.sh @@ -22,12 +22,12 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then # If the DB user is 'root' then use the MySQL root password env var : ${JOOMLA_DB_USER:=root} - if [ "$JOOMLA_DB_USER" = 'root' ]; then + if [ "$JOOMLA_DB_USER" = 'root' ] && [ "$JOOMLA_DB_PASSWORD_ALLOW_EMPTY" != 'yes' ]; then : ${JOOMLA_DB_PASSWORD:=$MYSQL_ENV_MYSQL_ROOT_PASSWORD} fi : ${JOOMLA_DB_NAME:=joomla} - if [ -z "$JOOMLA_DB_PASSWORD" ]; then + if [ -z "$JOOMLA_DB_PASSWORD" ] && [ "$JOOMLA_DB_PASSWORD_ALLOW_EMPTY" != 'yes' ]; then echo >&2 "error: missing required JOOMLA_DB_PASSWORD environment variable" echo >&2 " Did you forget to -e JOOMLA_DB_PASSWORD=... ?" echo >&2