You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
559 B
Go
34 lines
559 B
Go
package api
|
|
|
|
import (
|
|
"github.com/0xJacky/Nginx-UI/server/pkg/nginx"
|
|
"github.com/gin-gonic/gin"
|
|
"net/http"
|
|
)
|
|
|
|
func BuildNginxConfig(c *gin.Context) {
|
|
var ngxConf nginx.NgxConfig
|
|
if !BindAndValid(c, &ngxConf) {
|
|
return
|
|
}
|
|
|
|
c.JSON(http.StatusOK, gin.H{
|
|
"content": ngxConf.BuildConfig(),
|
|
})
|
|
}
|
|
|
|
func TokenizeNginxConfig(c *gin.Context) {
|
|
var json struct {
|
|
Content string `json:"content" binding:"required"`
|
|
}
|
|
|
|
if !BindAndValid(c, &json) {
|
|
return
|
|
}
|
|
|
|
ngxConfig := nginx.ParseNgxConfigByContent(json.Content)
|
|
|
|
c.JSON(http.StatusOK, ngxConfig)
|
|
|
|
}
|