소스 검색

feat: Add unauthenticated readyz endpoint (#600)

James Read 1 년 전
부모
커밋
224d7f40ed
1개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  1. 8 0
      service/internal/httpservers/singleFrontend.go

+ 8 - 0
service/internal/httpservers/singleFrontend.go

@@ -60,6 +60,8 @@ func StartSingleHTTPFrontend(cfg *config.Config) {
 
 	mux.HandleFunc("/oauth/callback", handleOAuthCallback)
 
+	mux.HandleFunc("/readyz", handleReadyz)
+
 	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
 		logDebugRequest(cfg, "ui  ", r)
 
@@ -86,3 +88,9 @@ func StartSingleHTTPFrontend(cfg *config.Config) {
 
 	log.Fatal(srv.ListenAndServe())
 }
+
+func handleReadyz(w http.ResponseWriter, r *http.Request) {
+	w.Header().Set("Content-Type", "text/plain; charset=utf-8")
+	w.WriteHeader(http.StatusOK)
+	w.Write([]byte("OK. Single HTTP Frontend is ready.\n"))
+}