add config app
This commit is contained in:
24
api.go
24
api.go
@@ -48,3 +48,27 @@ func ApiConfig(c *gin.Context) {
|
||||
c.Data(http.StatusOK, "application/json", b)
|
||||
}
|
||||
}
|
||||
|
||||
func ApiConfigApp(c *gin.Context) {
|
||||
name := c.Param("app")
|
||||
found := false
|
||||
for _, app := range cfg.Apps {
|
||||
if app.Name == name {
|
||||
found = true
|
||||
if b, err := app.Pretty(); err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{
|
||||
"message": "error",
|
||||
"error": err,
|
||||
})
|
||||
} else {
|
||||
c.Data(http.StatusOK, "application/json", b)
|
||||
}
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{
|
||||
"message": "error",
|
||||
"error": "no app found",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user