irc-webhooks/config.go

31 lines
471 B
Go
Raw Normal View History

2018-11-16 19:31:45 +00:00
package main
import (
"encoding/json"
"io/ioutil"
"os"
)
type Config struct {
Secret string
2018-11-16 20:34:52 +00:00
BindHost string `json:"bind_host"`
BindPort string `json:"bind_port"`
2018-11-16 19:31:45 +00:00
}
func getConfig() Config {
f, err := os.Open("config.json")
if err != nil {
panic(err)
}
defer f.Close()
out := Config{}
data, err := ioutil.ReadAll(f)
if err != nil {
panic(err)
}
json.Unmarshal(data, &out)
return out
}