feat: reload cluster node settings from settings file #169

This commit is contained in:
Jacky 2024-05-08 15:32:45 +08:00
parent 29f1b7db89
commit e0366f949f
No known key found for this signature in database
GPG key ID: 215C21B10DF38B4D
13 changed files with 110 additions and 34 deletions

View file

@ -3,9 +3,11 @@ package cluster
import (
"github.com/0xJacky/Nginx-UI/api"
"github.com/0xJacky/Nginx-UI/internal/analytic"
"github.com/0xJacky/Nginx-UI/internal/cluster"
"github.com/0xJacky/Nginx-UI/internal/cosy"
"github.com/0xJacky/Nginx-UI/model"
"github.com/0xJacky/Nginx-UI/query"
"github.com/0xJacky/Nginx-UI/settings"
"github.com/gin-gonic/gin"
"github.com/spf13/cast"
"net/http"
@ -75,3 +77,19 @@ func DeleteEnvironment(c *gin.Context) {
c.JSON(http.StatusNoContent, nil)
}
func LoadEnvironmentFromSettings(c *gin.Context) {
err := settings.ReloadCluster()
if err != nil {
api.ErrHandler(c, err)
return
}
cluster.RegisterPredefinedNodes()
go analytic.RestartRetrieveNodesStatus()
c.JSON(http.StatusOK, gin.H{
"message": "ok",
})
}