control.go 576 B

12345678910111213141516171819202122232425262728293031
  1. package nginx
  2. import (
  3. "github.com/0xJacky/Nginx-UI/internal/nginx"
  4. "github.com/gin-gonic/gin"
  5. "net/http"
  6. )
  7. func Reload(c *gin.Context) {
  8. output := nginx.Reload()
  9. c.JSON(http.StatusOK, gin.H{
  10. "message": output,
  11. "level": nginx.GetLogLevel(output),
  12. })
  13. }
  14. func Test(c *gin.Context) {
  15. output := nginx.TestConf()
  16. c.JSON(http.StatusOK, gin.H{
  17. "message": output,
  18. "level": nginx.GetLogLevel(output),
  19. })
  20. }
  21. func Restart(c *gin.Context) {
  22. output := nginx.Restart()
  23. c.JSON(http.StatusOK, gin.H{
  24. "message": output,
  25. "level": nginx.GetLogLevel(output),
  26. })
  27. }