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