initrd/tools/testconf/main.go

35 lines
471 B
Go
Raw Normal View History

2023-12-17 12:48:18 +00:00
package main
import (
"bytes"
"flag"
"log"
"os"
"gopkg.in/yaml.v3"
config "novit.tech/direktil/pkg/bootstrapconfig"
)
func main() {
flag.Parse()
for _, arg := range flag.Args() {
log.Print("testing ", arg)
cfgBytes, err := os.ReadFile(arg)
if err != nil {
log.Fatal(err)
}
cfg := config.Config{}
dec := yaml.NewDecoder(bytes.NewBuffer(cfgBytes))
dec.KnownFields(true)
err = dec.Decode(&cfg)
if err != nil {
log.Fatal(err)
}
}
}