add app.boxes

This commit is contained in:
shoopea 2025-10-12 15:33:00 +02:00
parent 3c7838b10a
commit 2aca8b1ceb

34
app.go
View File

@ -507,3 +507,37 @@ func (a *App) Transfer() error {
return nil
}
func (a *App) Boxes() []*Box {
log.WithFields(log.Fields{"app": a.name}).Debugf("starting")
defer log.WithFields(log.Fields{"app": a.name}).Debugf("done")
cfgMx.Lock()
defer cfgMx.Unlock()
bm := make(map[string]struct{})
for _, s := range a.sources {
bm[s.Box()] = struct{}{}
}
for _, d := range a.destinations {
bm[d.Box()] = struct{}{}
}
for _, b := range a.before {
bm[b.Box()] = struct{}{}
}
for _, af := range a.after {
bm[af.Box()] = struct{}{}
}
bx := make([]*Box, 0)
for n := range bm {
bx = append(bx, cfg.box[n])
}
return bx
}