root: handle liveness probe in router

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2021-10-12 14:54:15 +02:00
parent 48f96ea55f
commit d39dbc7287
3 changed files with 4 additions and 9 deletions

View File

@ -39,6 +39,9 @@ func (ws *WebServer) configureProxy() {
}
ws.proxyErrorHandler(rw, r, fmt.Errorf("proxy not running"))
})
ws.m.Path("/-/health/live/").HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
rw.WriteHeader(204)
})
ws.m.PathPrefix("/").HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
if !ws.p.IsRunning() {
ws.proxyErrorHandler(rw, r, fmt.Errorf("authentik core not running yet"))