Skip to content

Commit 93d744f

Browse files
toadjaunerenatomefi
authored andcommitted
Make healthcheck path configurable through an env var
1 parent 9d3510e commit 93d744f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

php-fpm-healthcheck

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,6 @@ set -eu
4343

4444
OPTIND=1 # Reset getopt in case it has been used previously in the shell
4545

46-
# FastCGI variables
47-
export REQUEST_METHOD="GET"
48-
export SCRIPT_NAME="/status"
49-
export SCRIPT_FILENAME="/status"
50-
FCGI_CONNECT_DEFAULT="localhost:9000"
51-
5246
# Required software
5347
FCGI_CMD_PATH=$(command -v cgi-fcgi) || { >&2 echo "Make sure fcgi is installed (i.e. apk add --no-cache fcgi). Aborting."; exit 4; }
5448
command -v sed 1> /dev/null || { >&2 echo "Make sure sed is installed (i.e. apk add --no-cache busybox). Aborting."; exit 4; }
@@ -120,6 +114,13 @@ fi;
120114

121115
eval set -- "$GETOPT"
122116

117+
# FastCGI variables
118+
FCGI_CONNECT_DEFAULT="localhost:9000"
119+
FCGI_STATUS_PATH_DEFAULT="/status"
120+
121+
export REQUEST_METHOD="GET"
122+
export SCRIPT_NAME="${FCGI_STATUS_PATH:-$FCGI_STATUS_PATH_DEFAULT}"
123+
export SCRIPT_FILENAME="${FCGI_STATUS_PATH:-$FCGI_STATUS_PATH_DEFAULT}"
123124
FCGI_CONNECT="${FCGI_CONNECT:-$FCGI_CONNECT_DEFAULT}"
124125

125126
VERBOSE=0

0 commit comments

Comments
 (0)