package kraSettingsConfig

import (
	"io/ioutil"
	"log"

	"gopkg.in/yaml.v3"
	serverconfig "krakatoa.net/backend/modules/configs/serverConfig"
)

var Cfg Config

type Config struct {
	VoiceWebCode VoiceWebCode `yaml:"voice_web_code"`
}

type VoiceWebCode struct {
	Letters string
	Length  int
}

func LoadKraSettingsConfig() {
	file, err := ioutil.ReadFile(serverconfig.Cfg.KraSettingsConfigPath)

	if err != nil {
		log.Println("failed to load yaml file", err)
	}

	err = yaml.Unmarshal(file, &Cfg)

	if err != nil {
		log.Fatalln("failed to unmarshal kraSettingsConfig", err)
	}
}
