Skip to content

Commit

Permalink
config api (#1716)
Browse files Browse the repository at this point in the history
  • Loading branch information
710leo committed Sep 19, 2023
1 parent 44ed90e commit a647526
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions center/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,9 @@ func (rt *Router) Config(r *gin.Engine) {
pages.POST("/es-index-pattern", rt.auth(), rt.admin(), rt.esIndexPatternAdd)
pages.PUT("/es-index-pattern", rt.auth(), rt.admin(), rt.esIndexPatternPut)
pages.DELETE("/es-index-pattern", rt.auth(), rt.admin(), rt.esIndexPatternDel)

pages.GET("/config", rt.auth(), rt.admin(), rt.configGetByKey)
pages.PUT("/config", rt.auth(), rt.admin(), rt.configPutByKey)
}

r.GET("/api/n9e/versions", func(c *gin.Context) {
Expand Down
6 changes: 6 additions & 0 deletions center/router/router_configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ func (rt *Router) configGetByKey(c *gin.Context) {
ginx.NewRender(c).Data(config, err)
}

func (rt *Router) configPutByKey(c *gin.Context) {
var f models.Configs
ginx.BindJSON(c, &f)
ginx.NewRender(c).Message(models.ConfigsSet(rt.Ctx, f.Ckey, f.Cval))
}

func (rt *Router) configsDel(c *gin.Context) {
var f idsForm
ginx.BindJSON(c, &f)
Expand Down

0 comments on commit a647526

Please sign in to comment.