mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 10:25:52 +02:00
feat(wip): docker ui only
This commit is contained in:
parent
c62fd25b2e
commit
d4a4ed1e1c
43 changed files with 1269 additions and 372 deletions
|
@ -5,24 +5,36 @@ import (
|
|||
|
||||
"github.com/0xJacky/Nginx-UI/internal/nginx"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/uozi-tech/cosy"
|
||||
)
|
||||
|
||||
// Reload reloads the nginx
|
||||
func Reload(c *gin.Context) {
|
||||
output := nginx.Reload()
|
||||
output, err := nginx.Reload()
|
||||
if err != nil {
|
||||
cosy.ErrHandler(c, err)
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"message": output,
|
||||
"level": nginx.GetLogLevel(output),
|
||||
})
|
||||
}
|
||||
|
||||
func Test(c *gin.Context) {
|
||||
output := nginx.TestConf()
|
||||
// TestConfig tests the nginx config
|
||||
func TestConfig(c *gin.Context) {
|
||||
output, err := nginx.TestConfig()
|
||||
if err != nil {
|
||||
cosy.ErrHandler(c, err)
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"message": output,
|
||||
"level": nginx.GetLogLevel(output),
|
||||
})
|
||||
}
|
||||
|
||||
// Restart restarts the nginx
|
||||
func Restart(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"message": "ok",
|
||||
|
@ -30,8 +42,13 @@ func Restart(c *gin.Context) {
|
|||
go nginx.Restart()
|
||||
}
|
||||
|
||||
// Status returns the status of the nginx
|
||||
func Status(c *gin.Context) {
|
||||
lastOutput := nginx.GetLastOutput()
|
||||
lastOutput, err := nginx.GetLastOutput()
|
||||
if err != nil {
|
||||
cosy.ErrHandler(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
running := nginx.IsNginxRunning()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue