1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2026-01-08 17:51:57 +00:00

Add /exit endpoint to monitoring server

Allows terminating chasquid via the network. Useful to trigger a restart
(if there is an init system to relaunch chasquid) and thus reload certificates.

Amended-by: Alberto Bertogli <albertito@blitiri.com.ar>
  Added tests, and adjusted shutdown sequence.
This commit is contained in:
ThinkChaos
2020-10-31 21:46:47 +01:00
committed by Alberto Bertogli
parent e9c6775418
commit bb1b921e3c
4 changed files with 50 additions and 2 deletions

View File

@@ -62,4 +62,15 @@ then
fail "new chasquid log did not have the expected entry"
fi
# Test that we can make the server exit using the /exit endpoint.
# First, a GET should fail with status 405.
fexp http://localhost:1099/exit -status 405
# A POST should succeed, return an OK body, and the daemon should
# eventually exit.
CHASQUID_PID=$(pgrep -s 0 chasquid)
fexp http://localhost:1099/exit -method POST -bodyre "OK"
wait_until ! kill -s 0 $CHASQUID_PID 2> /dev/null
success