0
0
mirror of https://github.com/vx3r/wg-gen-web.git synced 2025-09-10 12:14:28 +00:00

update readme, some improvements in error handling

This commit is contained in:
Christoph Haas
2020-10-06 22:55:17 +02:00
parent 3c155f1c97
commit 76434020af
5 changed files with 65 additions and 8 deletions

View File

@ -2,6 +2,7 @@ package status
import (
"net/http"
"os"
"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
@ -12,11 +13,16 @@ import (
func ApplyRoutes(r *gin.RouterGroup) {
g := r.Group("/status")
{
g.GET("/enabled", readEnabled)
g.GET("/interface", readInterfaceStatus)
g.GET("/clients", readClientStatus)
}
}
func readEnabled(c *gin.Context) {
c.JSON(http.StatusOK, os.Getenv("WG_STATS_API") != "")
}
func readInterfaceStatus(c *gin.Context) {
status, err := core.ReadInterfaceStatus()
if err != nil {