fix:err and name

pull/2341/head
icey-yu 1 year ago
parent 7bf29e8e5a
commit cb47d57ccd

@ -24,7 +24,7 @@ geTui:
channelName: '' channelName: ''
fcm: fcm:
serviceAccount: "x.json" serviceAccount: "x.json"
verifyUrl: "" authUrl: ""
jpns: jpns:
appKey: '' appKey: ''
masterSecret: '' masterSecret: ''

@ -52,16 +52,16 @@ func NewClient(pushConf *config.Push, cache cache.ThirdCache, fcmConfigPath stri
// with file path // with file path
credentialsFilePath := filepath.Join(fcmConfigPath, pushConf.FCM.ServiceAccount) credentialsFilePath := filepath.Join(fcmConfigPath, pushConf.FCM.ServiceAccount)
opt = option.WithCredentialsFile(credentialsFilePath) opt = option.WithCredentialsFile(credentialsFilePath)
case len(pushConf.FCM.VerifyUrl) != 0: case len(pushConf.FCM.AuthUrl) != 0:
// with verify url // with authentication url
client := httputil.NewHTTPClient(httputil.NewClientConfig()) client := httputil.NewHTTPClient(httputil.NewClientConfig())
resp, err := client.Get(pushConf.FCM.VerifyUrl) resp, err := client.Get(pushConf.FCM.AuthUrl)
if err != nil { if err != nil {
return nil, errs.Wrap(err) return nil, err
} }
opt = option.WithCredentialsJSON(resp) opt = option.WithCredentialsJSON(resp)
default: default:
return nil, errs.New("no FCM config") return nil, errs.New("no FCM config").Wrap()
} }
fcmApp, err := firebase.NewApp(context.Background(), nil, opt) fcmApp, err := firebase.NewApp(context.Background(), nil, opt)

@ -203,7 +203,7 @@ type Push struct {
} `mapstructure:"geTui"` } `mapstructure:"geTui"`
FCM struct { FCM struct {
ServiceAccount string `mapstructure:"serviceAccount"` ServiceAccount string `mapstructure:"serviceAccount"`
VerifyUrl string `mapstructure:"verifyUrl"` AuthUrl string `mapstructure:"authUrl"`
} `mapstructure:"fcm"` } `mapstructure:"fcm"`
JPNS struct { JPNS struct {
AppKey string `mapstructure:"appKey"` AppKey string `mapstructure:"appKey"`

Loading…
Cancel
Save