28 lines
546 B
Go
28 lines
546 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"os"
|
|
)
|
|
|
|
// Config 对应 config.json 结构
|
|
type Config struct {
|
|
SecretToken string `json:"secret_token"`
|
|
Projects map[string]map[string]string `json:"projects"`
|
|
DeviceKeys []string `json:"device_keys"`
|
|
}
|
|
|
|
var (
|
|
globalConfig Config
|
|
// bark 推送消息
|
|
pushURL = "https://bark.maimaicuizhiji.top/push"
|
|
)
|
|
|
|
func loadConfig(path string) error {
|
|
file, err := os.ReadFile(path)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return json.Unmarshal(file, &globalConfig)
|
|
}
|