Skip to content

Commit 768bbf2

Browse files
committed
adjust config.yaml, fixed test.
1 parent e8fef04 commit 768bbf2

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

config/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ ios:
4444
production: false
4545
max_retry: 0 # resend fail notification, default value zero is disabled
4646
key_map:
47-
cert1: "key.pem"
47+
cert1: "cert1.pem"
4848
cert2: "cert2.pem"
4949
cert3: "cert3.pem"
5050
key_password:

gorush/notification_apns.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,13 @@ func InitAPNSClient(key string) (*apns.Client, error) {
2222
LogError.Errorf("Key %s key_password not exist", key)
2323
return nil, errors.New("APNS key_password not exists")
2424
}
25+
path = PushConf.Ios.KeyMap[key]
26+
password = PushConf.Ios.KeyMap[key]
2527
} else {
2628
path = PushConf.Ios.KeyPath
2729
password = PushConf.Ios.Password
2830
}
31+
2932
if c, ok := ApnsClients[path]; ok {
3033
return c, nil
3134
}

gorush/notification_apns_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ func TestProvideApnsClient(t *testing.T) {
438438
PushConf = config.BuildDefaultPushConf()
439439

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

456-
// send fail
456+
// send success
457457
isError := PushToIOS(req)
458458
assert.True(t, isError)
459459
}

0 commit comments

Comments
 (0)