mirror of
https://git.ferricyanide.solutions/A_D/irc-webhooks.git
synced 2024-12-22 19:57:03 +00:00
31 lines
471 B
Go
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
|
|
}
|