You've already forked nginx-proxy-manager
							
							
				mirror of
				https://github.com/NginxProxyManager/nginx-proxy-manager.git
				synced 2025-10-30 18:05:34 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			35 lines
		
	
	
		
			878 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			878 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package handler
 | |
| 
 | |
| import (
 | |
| 	"net/http"
 | |
| 	"npm/internal/acme"
 | |
| 	h "npm/internal/api/http"
 | |
| 	"npm/internal/config"
 | |
| )
 | |
| 
 | |
| type healthCheckResponse struct {
 | |
| 	Version        string `json:"version"`
 | |
| 	Commit         string `json:"commit"`
 | |
| 	AcmeShVersion  string `json:"acme.sh"`
 | |
| 	Healthy        bool   `json:"healthy"`
 | |
| 	IsSetup        bool   `json:"setup"`
 | |
| 	ErrorReporting bool   `json:"error_reporting"`
 | |
| }
 | |
| 
 | |
| // Health returns the health of the api
 | |
| // Route: GET /health
 | |
| func Health() func(http.ResponseWriter, *http.Request) {
 | |
| 	return func(w http.ResponseWriter, r *http.Request) {
 | |
| 		health := healthCheckResponse{
 | |
| 			Version:        config.Version,
 | |
| 			Commit:         config.Commit,
 | |
| 			Healthy:        true,
 | |
| 			IsSetup:        config.IsSetup,
 | |
| 			AcmeShVersion:  acme.GetAcmeShVersion(),
 | |
| 			ErrorReporting: config.ErrorReporting,
 | |
| 		}
 | |
| 
 | |
| 		h.ResultResponseJSON(w, r, http.StatusOK, health)
 | |
| 	}
 | |
| }
 |