Milen/config.go

28 lines
461 B
Go

2020-05-11 05:30:07 +07:00
package main
import (
"io/ioutil"
"github.com/BurntSushi/toml"
)
type config struct {
Token string
2020-05-30 12:51:04 +07:00
ReportTarget string `toml:"report_target"`
MacroReplace map[string]string `toml:"macro_replace"`
Macro map[string]string
2020-05-11 05:30:07 +07:00
}
func LoadConfig() config {
bytes, err := ioutil.ReadFile("config.toml")
if err != nil {
panic(err)
}
var cfg config
err = toml.Unmarshal(bytes, &cfg)
if err != nil {
panic(err)
}
return cfg
}