File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -96,11 +96,21 @@ if ! grep -qx '^post_max_size.*$' /config/php/php-local.ini; then
9696 echo 'post_max_size = 100M' >> /config/php/php-local.ini
9797fi
9898
99+ # extract actual host and port from DB_HOST endpoint format, not support IPv6
100+ # DB_HOST enpoint 'domainIp:port' or 'domainIp'
101+ # DB_HOST_ONLY drop ':port' portion
102+ # DB_PORT_ONLY drop host_only portion, remains '' or ':port'
103+ # DB_PORT_ONLY drop ':' if any, remain '' or 'port'
104+ # ${DB_PORT_ONLY:-3306} use default 3306 if missing
105+ DB_HOST_ONLY=${DB_HOST%:*}
106+ DB_PORT_ONLY=${DB_HOST#$DB_HOST_ONLY}
107+ DB_PORT_ONLY=${DB_PORT_ONLY#:}
108+
99109# check for the mysql endpoint for 30 seconds
100110END=$((SECONDS+30))
101- while [ ${SECONDS} -lt ${END} ] && [ -n "${DB_HOST +x}" ]; do
102- if /usr/bin/nc -z ${DB_HOST} 3306; then
103- if [ ! -z "$(/usr/bin/nc -w1 ${DB_HOST} 3306)" ]; then
111+ while [ ${SECONDS} -lt ${END} ] && [ -n "${DB_HOST_ONLY +x}" ]; do
112+ if /usr/bin/nc -z ${DB_HOST_ONLY} ${DB_PORT_ONLY:- 3306} ; then
113+ if [ ! -z "$(/usr/bin/nc -w1 ${DB_HOST_ONLY} ${DB_PORT_ONLY:- 3306} )" ]; then
104114 if [ ! -z "${RUN}" ]; then
105115 break
106116 fi
You can’t perform that action at this time.
0 commit comments