add healthz api (#2511)

This commit is contained in:
fatedier
2021-08-04 14:33:53 +08:00
committed by GitHub
parent f570dcb307
commit 82f80a22be
4 changed files with 13 additions and 1 deletions

View File

@@ -37,7 +37,8 @@ func (svr *Service) RunAdminServer(address string) (err error) {
user, passwd := svr.cfg.AdminUser, svr.cfg.AdminPwd
router.Use(frpNet.NewHTTPAuthMiddleware(user, passwd).Middleware)
// api, see dashboard_api.go
// api, see admin_api.go
router.HandleFunc("/healthz", svr.healthz)
router.HandleFunc("/api/reload", svr.apiReload).Methods("GET")
router.HandleFunc("/api/status", svr.apiStatus).Methods("GET")
router.HandleFunc("/api/config", svr.apiGetConfig).Methods("GET")

View File

@@ -32,6 +32,11 @@ type GeneralResponse struct {
Msg string
}
// /healthz
func (svr *Service) healthz(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(200)
}
// GET api/reload
func (svr *Service) apiReload(w http.ResponseWriter, r *http.Request) {
res := GeneralResponse{Code: 200}