mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-11-23 12:30:41 +01:00
ci: set db port if empty
This commit is contained in:
parent
d73c8f2edb
commit
f452cf546e
@ -80,22 +80,34 @@ case "$SEMAPHORE_DB_HOST" in
|
||||
*)
|
||||
esac
|
||||
|
||||
if [ -z "${SEMAPHORE_DB_PORT}" ]; then
|
||||
case ${SEMAPHORE_DB_DIALECT} in
|
||||
mysql)
|
||||
SEMAPHORE_DB_PORT=3306
|
||||
;;
|
||||
postgres)
|
||||
SEMAPHORE_DB_PORT=5432
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Ping database if it is not BoltDB
|
||||
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} ..."
|
||||
TIMEOUT=30
|
||||
echoerr "Attempting to connect to database ${SEMAPHORE_DB} on ${SEMAPHORE_DB_HOST}:${SEMAPHORE_DB_PORT} with user ${SEMAPHORE_DB_USER} ..."
|
||||
TIMEOUT=30
|
||||
|
||||
while ! $(nc -z "$SEMAPHORE_DB_HOST" "$SEMAPHORE_DB_PORT") >/dev/null 2>&1; do
|
||||
TIMEOUT=$(expr $TIMEOUT - 1)
|
||||
|
||||
if [ $TIMEOUT -eq 0 ]; then
|
||||
echoerr "Could not connect to database server. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
while ! $(nc -z "$SEMAPHORE_DB_HOST" "$SEMAPHORE_DB_PORT") >/dev/null 2>&1; do
|
||||
TIMEOUT=$(expr $TIMEOUT - 1)
|
||||
|
||||
echo -n "."
|
||||
sleep 1
|
||||
done
|
||||
if [ $TIMEOUT -eq 0 ]; then
|
||||
echoerr "Could not connect to database server. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -n "."
|
||||
sleep 1
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -n "${SEMAPHORE_DB_PORT}" ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user