ci(docker): allow port in SEMAPHORE_DB_HOST

This commit is contained in:
fiftin 2024-05-25 21:49:46 +02:00
parent 3311b00891
commit bb7a156f10
No known key found for this signature in database
GPG Key ID: 044381366A5D4731

View File

@ -72,6 +72,16 @@ file_env 'SEMAPHORE_ACCESS_KEY_ENCRYPTION'
exit 1 exit 1
} }
# Check if $SEMAPHORE_DB_HOST contains port number.
case "$SEMAPHORE_DB_HOST" in
*:*)
SEMAPHORE_DB_PORT=$(echo "$SEMAPHORE_DB_HOST" | cut -d ':' -f 2)
SEMAPHORE_DB_HOST=$(echo "$SEMAPHORE_DB_HOST" | cut -d ':' -f 1)
;;
*)
esac
# Ping database if it is not BoltDB
if [ "${SEMAPHORE_DB_DIALECT}" != 'bolt' ]; then if [ "${SEMAPHORE_DB_DIALECT}" != 'bolt' ]; then
echoerr "Attempting to connect to database ${SEMAPHORE_DB} on ${SEMAPHORE_DB_HOST}:${SEMAPHORE_DB_PORT} with user ${SEMAPHORE_DB_USER} ..." echoerr "Attempting to connect to database ${SEMAPHORE_DB} on ${SEMAPHORE_DB_HOST}:${SEMAPHORE_DB_PORT} with user ${SEMAPHORE_DB_USER} ..."
TIMEOUT=30 TIMEOUT=30