1
0
Fork 0
mirror of https://github.com/Luzifer/automail.git synced 2024-12-20 13:01:20 +00:00
automail/config.go

25 lines
419 B
Go
Raw Permalink Normal View History

2020-06-27 13:25:16 +00:00
package main
import (
"os"
"github.com/pkg/errors"
"gopkg.in/yaml.v2"
)
type config struct {
Handlers []mailHandler `yaml:"handlers"`
}
func loadConfig() (*config, error) {
var out = &config{}
f, err := os.Open(cfg.Config)
if err != nil {
return nil, errors.Wrap(err, "Unable to open config file")
}
defer f.Close()
return out, errors.Wrap(yaml.NewDecoder(f).Decode(out), "Unable to decode config")
}