app run skeleton
This commit is contained in:
parent
2aca8b1ceb
commit
6ae863b60c
15
api.go
15
api.go
@ -14,10 +14,17 @@ func ApiRun(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ApiRunApp(c *gin.Context) {
|
func ApiRunApp(c *gin.Context) {
|
||||||
if _, ok := cfg.apps[c.Param("app")]; ok {
|
if app, ok := cfg.apps[c.Param("app")]; ok {
|
||||||
c.JSON(http.StatusOK, gin.H{
|
if err := app.RunFull(); err != nil {
|
||||||
"message": "done",
|
c.JSON(http.StatusInternalServerError, gin.H{
|
||||||
})
|
"message": "error",
|
||||||
|
"error": err,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"message": "done",
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{
|
c.JSON(http.StatusInternalServerError, gin.H{
|
||||||
"message": "error",
|
"message": "error",
|
||||||
|
16
app.go
16
app.go
@ -541,3 +541,19 @@ func (a *App) Boxes() []*Box {
|
|||||||
|
|
||||||
return bx
|
return bx
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *App) RunFull() error {
|
||||||
|
log.WithFields(log.Fields{"app": a.name}).Debugf("starting")
|
||||||
|
defer log.WithFields(log.Fields{"app": a.name}).Debugf("done")
|
||||||
|
|
||||||
|
boxes := a.Boxes()
|
||||||
|
|
||||||
|
for _, box := range boxes {
|
||||||
|
if err := box.Open(); err != nil {
|
||||||
|
log.WithFields(log.Fields{"app": a.name, "call": "box.Open", "box": box.name, "error": err}).Errorf("")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer box.Close()
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Code generated by version.sh (@generated) DO NOT EDIT.
|
// Code generated by version.sh (@generated) DO NOT EDIT.
|
||||||
package main
|
package main
|
||||||
var githash = "fd02cfd"
|
var githash = "2aca8b1"
|
||||||
var branch = "master"
|
var branch = "master"
|
||||||
var buildstamp = "2025-10-07_18:55:46"
|
var buildstamp = "2025-10-19_11:33:05"
|
||||||
var commits = "110"
|
var commits = "112"
|
||||||
var version = "fd02cfd-b110 - 2025-10-07_18:55:46"
|
var version = "2aca8b1-b112 - 2025-10-19_11:33:05"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user