package main

import (
	"log"
	"os"

	"gopkg.in/yaml.v3"
)
type AppConfig struct{	
	HostExpose bool `yaml:"server-host-expose"`
	ServerPort uint16 `yaml:"port"`
	Brand string `yaml:"branding"`
	DataBasePath string `yaml:"db-path"`
}


func loadConfig (configPath string) AppConfig{
	data, err := os.ReadFile(configPath)
	if err != nil{
		log.Fatalf("cant read config file %v - %v", configPath, err)
	}
	var cfg AppConfig
	if err := yaml.Unmarshal(data, &cfg); err != nil{
		log.Fatalf("cant decode config %v - %v", configPath, err)
	}

	return cfg
}