initrd/tools/testconf/main.go
2023-12-17 13:48:18 +01:00

35 lines
471 B
Go

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)
}
}
}