/
config.go
36 lines (31 loc) · 1.03 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package notification
import (
"github.com/sideshow/apns2"
"github.com/ylywyn/jpush-api-go-client"
)
// 推送配置
type NotificationConfig struct {
Android SectionAndroid
Ios SectionIos
}
type SectionAndroid struct {
Enabled bool `yaml:"enabled"`
AppKey string `yaml:"appkey"`
Secret string `yaml:"secret"`
}
type SectionIos struct {
Enabled bool `yaml:"enabled" json:"enabled"`
KeyPath string `yaml:"key_path" json:"key_path"`
KeyBase64 string `yaml:"key_base64" json:"key_base64"`
KeyType string `yaml:"key_type" json:"key_type"`
Password string `yaml:"password" json:"password"`
Production bool `yaml:"production" json:"production"`
MaxRetry int `yaml:"max_retry" json:"max_retry"`
KeyID string `yaml:"key_id" json:"key_id"`
TeamID string `yaml:"team_id" json:"team_id"`
}
var (
Config NotificationConfig // 配置文件 支持yaml、json 导入
ApnsClient *apns2.Client // Apns(IOS)推送实例
AndroidClient *jpushclient.PushClient // 极光(Android)推送实例
)