irc-webhooks/config.go
2018-11-16 22:34:52 +02:00

31 lines
471 B
Go

package main
import (
"encoding/json"
"io/ioutil"
"os"
)
type Config struct {
Secret string
BindHost string `json:"bind_host"`
BindPort string `json:"bind_port"`
}
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
}