Skip to content

Commit 61dd78c

Browse files
committed
Merge pull request docker-library#144 from infosiftr/simpler-linking
Simplify linking
2 parents d67618b + fe50e28 commit 61dd78c

File tree

3 files changed

+3
-51
lines changed

3 files changed

+3
-51
lines changed

apache/docker-entrypoint.sh

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,7 @@
22
set -e
33

44
if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
5-
if [ -n "$MYSQL_PORT_3306_TCP" ]; then
6-
if [ -z "$WORDPRESS_DB_HOST" ]; then
7-
WORDPRESS_DB_HOST='mysql'
8-
else
9-
echo >&2 'warning: both WORDPRESS_DB_HOST and MYSQL_PORT_3306_TCP found'
10-
echo >&2 " Connecting to WORDPRESS_DB_HOST ($WORDPRESS_DB_HOST)"
11-
echo >&2 ' instead of the linked mysql container'
12-
fi
13-
fi
14-
15-
if [ -z "$WORDPRESS_DB_HOST" ]; then
16-
echo >&2 'error: missing WORDPRESS_DB_HOST and MYSQL_PORT_3306_TCP environment variables'
17-
echo >&2 ' Did you forget to --link some_mysql_container:mysql or set an external db'
18-
echo >&2 ' with -e WORDPRESS_DB_HOST=hostname:port?'
19-
exit 1
20-
fi
21-
5+
: "${WORDPRESS_DB_HOST:=mysql}"
226
# if we're linked to MySQL and thus have credentials already, let's use them
237
: ${WORDPRESS_DB_USER:=${MYSQL_ENV_MYSQL_USER:-root}}
248
if [ "$WORDPRESS_DB_USER" = 'root' ]; then

docker-entrypoint.sh

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,7 @@
22
set -e
33

44
if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
5-
if [ -n "$MYSQL_PORT_3306_TCP" ]; then
6-
if [ -z "$WORDPRESS_DB_HOST" ]; then
7-
WORDPRESS_DB_HOST='mysql'
8-
else
9-
echo >&2 'warning: both WORDPRESS_DB_HOST and MYSQL_PORT_3306_TCP found'
10-
echo >&2 " Connecting to WORDPRESS_DB_HOST ($WORDPRESS_DB_HOST)"
11-
echo >&2 ' instead of the linked mysql container'
12-
fi
13-
fi
14-
15-
if [ -z "$WORDPRESS_DB_HOST" ]; then
16-
echo >&2 'error: missing WORDPRESS_DB_HOST and MYSQL_PORT_3306_TCP environment variables'
17-
echo >&2 ' Did you forget to --link some_mysql_container:mysql or set an external db'
18-
echo >&2 ' with -e WORDPRESS_DB_HOST=hostname:port?'
19-
exit 1
20-
fi
21-
5+
: "${WORDPRESS_DB_HOST:=mysql}"
226
# if we're linked to MySQL and thus have credentials already, let's use them
237
: ${WORDPRESS_DB_USER:=${MYSQL_ENV_MYSQL_USER:-root}}
248
if [ "$WORDPRESS_DB_USER" = 'root' ]; then

fpm/docker-entrypoint.sh

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,7 @@
22
set -e
33

44
if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
5-
if [ -n "$MYSQL_PORT_3306_TCP" ]; then
6-
if [ -z "$WORDPRESS_DB_HOST" ]; then
7-
WORDPRESS_DB_HOST='mysql'
8-
else
9-
echo >&2 'warning: both WORDPRESS_DB_HOST and MYSQL_PORT_3306_TCP found'
10-
echo >&2 " Connecting to WORDPRESS_DB_HOST ($WORDPRESS_DB_HOST)"
11-
echo >&2 ' instead of the linked mysql container'
12-
fi
13-
fi
14-
15-
if [ -z "$WORDPRESS_DB_HOST" ]; then
16-
echo >&2 'error: missing WORDPRESS_DB_HOST and MYSQL_PORT_3306_TCP environment variables'
17-
echo >&2 ' Did you forget to --link some_mysql_container:mysql or set an external db'
18-
echo >&2 ' with -e WORDPRESS_DB_HOST=hostname:port?'
19-
exit 1
20-
fi
21-
5+
: "${WORDPRESS_DB_HOST:=mysql}"
226
# if we're linked to MySQL and thus have credentials already, let's use them
237
: ${WORDPRESS_DB_USER:=${MYSQL_ENV_MYSQL_USER:-root}}
248
if [ "$WORDPRESS_DB_USER" = 'root' ]; then

0 commit comments

Comments
 (0)