authelia/healthcheck.sh
Amir Zarrinkafsh ac92643212
test(handlers): add health check to coverage build (#1684)
* test(handlers): add health check to coverage build

This change ensures that the integration test container also utilises the health check script to ensure coverage for this area of code.

* update health check script for coverage container

* remove start period and ignore cert check
2021-02-03 10:17:46 +11:00

24 lines
793 B
Bash
Executable File

#!/bin/sh
AUTHELIA_CONFIG=$(pgrep -af authelia | awk '{print $NF}')
AUTHELIA_SCHEME=$(grep ^tls "${AUTHELIA_CONFIG}")
AUTHELIA_HOST=$(grep ^host "${AUTHELIA_CONFIG}" | sed -e 's/host: //' -e 's/\r//')
AUTHELIA_PORT=$(grep ^port "${AUTHELIA_CONFIG}" | sed -e 's/port: //' -e 's/\r//')
AUTHELIA_PATH=$(grep ^\ \ path "${AUTHELIA_CONFIG}" | sed -e 's/ path: //' -e 's/\r//' -e 's/^/\//')
if [ -z "${AUTHELIA_SCHEME}" ]; then
AUTHELIA_SCHEME=http
else
AUTHELIA_SCHEME=https
fi
if [ -z "${AUTHELIA_HOST}" ] || [ "${AUTHELIA_HOST}" = "0.0.0.0" ]; then
AUTHELIA_HOST=localhost
fi
if [ -z "${AUTHELIA_PORT}" ]; then
AUTHELIA_PORT=9091
fi
wget --quiet --no-check-certificate --tries=1 --spider "${AUTHELIA_SCHEME}://${AUTHELIA_HOST}:${AUTHELIA_PORT}${AUTHELIA_PATH}/api/health" || exit 1