Update root/etc/cont-init.d/50-config

Avoid grep -E, change to regex

Co-authored-by: Eric Nemchik <eric@nemchik.com>
This commit is contained in:
Tho Ho 2022-12-22 22:12:55 +08:00 committed by GitHub
parent 8cb08dab14
commit 987b111e04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,7 +58,7 @@ fi
# if DB_HOST contains a port and DB_HOST is not a IPv6 without brackets [..]
# support ipv4:port, [ipv6]:port, and domain:port
if echo "$DB_HOST" | grep -qE ':[0-9]+$' && ! echo "$DB_HOST" | grep -qE '^(:{0,2}[a-fA-F0-9]{1,4})+$'; then
if [[ ${DB_HOST} =~ :[0-9]+$ ]] && ! [[ ${DB_HOST} =~ ^(:{0,2}[a-fA-F0-9]{1,4})+$ ]]; then
DB_HOST_PORT="${DB_HOST}"
fi