123456789101112131415161718192021222324252627282930313233343536 |
- package nginx
- import (
- "net/http"
- "github.com/0xJacky/Nginx-UI/internal/nginx"
- "github.com/gin-gonic/gin"
- "github.com/uozi-tech/cosy"
- )
- // GetPerformanceSettings retrieves current Nginx performance settings
- func GetPerformanceSettings(c *gin.Context) {
- // Get Nginx worker configuration info
- perfInfo, err := nginx.GetNginxWorkerConfigInfo()
- if err != nil {
- cosy.ErrHandler(c, err)
- return
- }
- c.JSON(http.StatusOK, perfInfo)
- }
- // UpdatePerformanceSettings updates Nginx performance settings
- func UpdatePerformanceSettings(c *gin.Context) {
- var perfOpt nginx.PerfOpt
- if !cosy.BindAndValid(c, &perfOpt) {
- return
- }
- err := nginx.UpdatePerfOpt(&perfOpt)
- if err != nil {
- cosy.ErrHandler(c, err)
- return
- }
- GetPerformanceSettings(c)
- }
|