35 lines
670 B
Go
35 lines
670 B
Go
|
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
|
||
|
|
||
|
package folio
|
||
|
|
||
|
import (
|
||
|
"log/slog"
|
||
|
)
|
||
|
|
||
|
// Dependencies describe a requirement on a given system property
|
||
|
|
||
|
// requires:
|
||
|
// arch: amd64
|
||
|
// foo: bar
|
||
|
|
||
|
type Dependencies map[string]Constraint
|
||
|
|
||
|
func (d Dependencies) Check() (matched bool) {
|
||
|
matched = true
|
||
|
for k,v := range d {
|
||
|
b, z := DocumentRegistry.ConfigNameMap.Get(k)
|
||
|
slog.Info("Dependencies.Check()", "key", k, "value", v, "block", b, "ok", z)
|
||
|
if configBlock, ok := DocumentRegistry.ConfigNameMap.Get(k); ok {
|
||
|
if ! v.Check(configBlock) {
|
||
|
matched = false
|
||
|
}
|
||
|
} else {
|
||
|
matched = false
|
||
|
return
|
||
|
}
|
||
|
}
|
||
|
return
|
||
|
}
|
||
|
|
||
|
|