add app.boxes
This commit is contained in:
parent
3c7838b10a
commit
2aca8b1ceb
34
app.go
34
app.go
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user