refactor:change FCM config name

pull/2341/head
icey-yu 1 year ago
parent 9ae653c32d
commit 2aed1fde47

@ -24,7 +24,7 @@ geTui:
channelName: '' channelName: ''
fcm: fcm:
# Prioritize using file paths. If the file path is empty, use URL # Prioritize using file paths. If the file path is empty, use URL
serviceAccount: "" # File path is concatenated with the parameters passed in through - c and serviceAccount. filePath: "" # File path is concatenated with the parameters passed in through - c(`mage` default pass in `config/`) and serviceAccount.
authURL: "" # file URL. Protocol must be specified. authURL: "" # file URL. Protocol must be specified.
jpns: jpns:
appKey: '' appKey: ''

@ -44,9 +44,9 @@ type Fcm struct {
func NewClient(pushConf *config.Push, cache cache.ThirdCache, fcmConfigPath string) (*Fcm, error) { func NewClient(pushConf *config.Push, cache cache.ThirdCache, fcmConfigPath string) (*Fcm, error) {
var opt option.ClientOption var opt option.ClientOption
switch { switch {
case len(pushConf.FCM.ServiceAccount) != 0: case len(pushConf.FCM.FilePath) != 0:
// with file path // with file path
credentialsFilePath := filepath.Join(fcmConfigPath, pushConf.FCM.ServiceAccount) credentialsFilePath := filepath.Join(fcmConfigPath, pushConf.FCM.FilePath)
opt = option.WithCredentialsFile(credentialsFilePath) opt = option.WithCredentialsFile(credentialsFilePath)
case len(pushConf.FCM.AuthUrl) != 0: case len(pushConf.FCM.AuthUrl) != 0:
// with authentication URL // with authentication URL

@ -202,8 +202,8 @@ type Push struct {
ChannelName string `mapstructure:"channelName"` ChannelName string `mapstructure:"channelName"`
} `mapstructure:"geTui"` } `mapstructure:"geTui"`
FCM struct { FCM struct {
ServiceAccount string `mapstructure:"serviceAccount"` FilePath string `mapstructure:"filePath"`
AuthUrl string `mapstructure:"authURL"` AuthUrl string `mapstructure:"authURL"`
} `mapstructure:"fcm"` } `mapstructure:"fcm"`
JPNS struct { JPNS struct {
AppKey string `mapstructure:"appKey"` AppKey string `mapstructure:"appKey"`

Loading…
Cancel
Save