fix:config name and annotation

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

@ -23,8 +23,9 @@ geTui:
channelID: ''
channelName: ''
fcm:
serviceAccount: "x.json"
authUrl: ""
# 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.
authURL: "" # file URL. Protocol must be specified.
jpns:
appKey: ''
masterSecret: ''

@ -42,10 +42,6 @@ type Fcm struct {
// NewClient initializes a new FCM client using the Firebase Admin SDK.
// It requires the FCM service account credentials file located within the project's configuration directory.
func NewClient(pushConf *config.Push, cache cache.ThirdCache, fcmConfigPath string) (*Fcm, error) {
//projectRoot, err := config.GetProjectRoot()
//if err != nil {
// return nil, err
//}
var opt option.ClientOption
switch {
case len(pushConf.FCM.ServiceAccount) != 0:
@ -53,7 +49,7 @@ func NewClient(pushConf *config.Push, cache cache.ThirdCache, fcmConfigPath stri
credentialsFilePath := filepath.Join(fcmConfigPath, pushConf.FCM.ServiceAccount)
opt = option.WithCredentialsFile(credentialsFilePath)
case len(pushConf.FCM.AuthUrl) != 0:
// with authentication url
// with authentication URL
client := httputil.NewHTTPClient(httputil.NewClientConfig())
resp, err := client.Get(pushConf.FCM.AuthUrl)
if err != nil {
@ -73,7 +69,6 @@ func NewClient(pushConf *config.Push, cache cache.ThirdCache, fcmConfigPath stri
if err != nil {
return nil, errs.Wrap(err)
}
return &Fcm{fcmMsgCli: fcmMsgClient, cache: cache}, nil
}

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

Loading…
Cancel
Save