film/config/haha.go

31 lines
456 B
Go
Raw Normal View History

2023-04-09 13:01:04 +08:00
package config
import (
"encoding/json"
"io/ioutil"
)
type Haha struct {
2023-04-09 13:05:52 +08:00
Token string `json:"token"`
SyncInterval int `json:"syncInterval"`
2023-04-09 13:01:04 +08:00
}
var (
hahaConfig *Haha = nil
)
func LoadHahaConfig() {
body, err := ioutil.ReadFile("conf/haha.json")
if err != nil {
panic(err)
}
2023-04-09 13:05:52 +08:00
hahaConfig = new(Haha)
if err := json.Unmarshal([]byte(body), hahaConfig); err != nil {
2023-04-09 13:01:04 +08:00
panic(err)
}
}
func GetHahaConfig() *Haha {
return hahaConfig
}