add config app

This commit is contained in:
shoopea
2025-10-07 20:56:21 +02:00
parent fd02cfdfc3
commit 3c7838b10a
4 changed files with 46 additions and 4 deletions

24
api.go
View File

@@ -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",
})
}
}