mirror of http://gitlab.batiao8.com/yic/film.git
31 lines
456 B
Go
31 lines
456 B
Go
package config
|
|
|
|
import (
|
|
"encoding/json"
|
|
"io/ioutil"
|
|
)
|
|
|
|
type Haha struct {
|
|
Token string `json:"token"`
|
|
SyncInterval int `json:"syncInterval"`
|
|
}
|
|
|
|
var (
|
|
hahaConfig *Haha = nil
|
|
)
|
|
|
|
func LoadHahaConfig() {
|
|
body, err := ioutil.ReadFile("conf/haha.json")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
hahaConfig = new(Haha)
|
|
if err := json.Unmarshal([]byte(body), hahaConfig); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
func GetHahaConfig() *Haha {
|
|
return hahaConfig
|
|
}
|