This commit is contained in:
sam 2023-09-03 00:23:48 +02:00
commit 2586161abd
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
49 changed files with 4171 additions and 0 deletions

22
config/parse.go Normal file
View file

@ -0,0 +1,22 @@
package config
import (
"os"
"emperror.dev/errors"
"github.com/BurntSushi/toml"
)
func Parse(filename string) (Config, error) {
var c Config
b, err := os.ReadFile(filename)
if err != nil {
return Config{}, errors.Wrap(err, "reading config file")
}
err = toml.Unmarshal(b, &c)
if err != nil {
return c, errors.Wrap(err, "unmarshaling config file")
}
return c, nil
}