mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-06 03:18:36 +08:00
Go CLI: fix show variable (#16370)
### What problem does this PR solve? ``` RAGFlow(api/default)> show var 'mail.port'; +-----------+-----------+--------------+-------+ | data_type | name | setting_type | value | +-----------+-----------+--------------+-------+ | integer | mail.port | config | 30 | +-----------+-----------+--------------+-------+ ``` ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --------- Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -289,6 +289,41 @@ func (h *SystemHandler) SetVariable(c *gin.Context) {
|
||||
})
|
||||
}
|
||||
|
||||
func (h *SystemHandler) ShowVariable(c *gin.Context) {
|
||||
encodedVarName := c.Param("var_name")
|
||||
|
||||
varName, err := common.DecodeFromBase64(encodedVarName)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"code": 400,
|
||||
"message": err.Error(),
|
||||
})
|
||||
return
|
||||
}
|
||||
if varName == "" {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"code": 400,
|
||||
"message": "Var name is required",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
variable, err := h.systemService.ShowVariable(varName)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"code": 500,
|
||||
"message": err.Error(),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"code": 0,
|
||||
"message": "SUCCESS",
|
||||
"data": variable,
|
||||
})
|
||||
}
|
||||
|
||||
// ListEnvironments handle list environments
|
||||
func (h *SystemHandler) ListEnvironments(c *gin.Context) {
|
||||
environments, err := h.systemService.ListEnvironments()
|
||||
|
||||
Reference in New Issue
Block a user