move config parsing into a separate module, fix project name

This commit is contained in:
Von Random 2025-02-09 16:06:39 +02:00
parent 0ab510adef
commit d6d8b1a9a6
4 changed files with 46 additions and 25 deletions

18
config/config.go Normal file
View file

@ -0,0 +1,18 @@
package config
import (
"log"
"os"
"gopkg.in/yaml.v3"
)
func Parse(path string, spec interface{}) error {
configData, err := os.ReadFile(path)
if err != nil {
log.Fatal(err)
return err
}
err = yaml.Unmarshal(configData, spec)
return nil
}