mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
f1ecc5b82a
This change points the Docker containers healthcheck to the dedicated `/api/health` endpoint and also includes support for Authelia running with a path prefix.
24 lines
769 B
Bash
Executable File
24 lines
769 B
Bash
Executable File
#!/bin/sh
|
|
|
|
AUTHELIA_CONFIG=$(pgrep -af authelia | awk '{print $4}')
|
|
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 --tries=1 --spider "${AUTHELIA_SCHEME}://${AUTHELIA_HOST}:${AUTHELIA_PORT}${AUTHELIA_PATH}/api/health" || exit 1
|