Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ ios:
production: false
max_retry: 0 # resend fail notification, default value zero is disabled
key_map:
cert1: "key.pem"
cert1: "cert1.pem"
cert2: "cert2.pem"
cert3: "cert3.pem"
key_password:
Expand Down
3 changes: 3 additions & 0 deletions gorush/notification_apns.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ func InitAPNSClient(key string) (*apns.Client, error) {
LogError.Errorf("Key %s key_password not exist", key)
return nil, errors.New("APNS key_password not exists")
}
path = PushConf.Ios.KeyMap[key]
password = PushConf.Ios.KeyMap[key]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

password = PushConf.Ios.KeyMap[key] needs to be changed to password = PushConf.Ios.KeyPass[key]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KeyPass

} else {
path = PushConf.Ios.KeyPath
password = PushConf.Ios.Password
}

if c, ok := ApnsClients[path]; ok {
return c, nil
}
Expand Down
4 changes: 2 additions & 2 deletions gorush/notification_apns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ func TestProvideApnsClient(t *testing.T) {
PushConf = config.BuildDefaultPushConf()

PushConf.Ios.Enabled = true
PushConf.Ios.KeyPath = "../certificate/certificate-valid.pem"
// PushConf.Ios.KeyPath = "../certificate/certificate-valid.pem"
ApnsClients = make(map[string]*apns2.Client, len(PushConf.Ios.KeyMap))
PushConf.Ios.KeyMap = map[string]string{"cert1": "../certificate/certificate-valid.pem"}
PushConf.Ios.KeyPass = map[string]string{"cert1": ""}
Expand All @@ -453,7 +453,7 @@ func TestProvideApnsClient(t *testing.T) {
ApnsClient: "cert1",
}

// send fail
// send success
isError := PushToIOS(req)
assert.True(t, isError)
}
Expand Down