Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

change the default value of use_fcm to true #94

Merged
merged 1 commit into from
Oct 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
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 CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ The configuration for Gaurun has some sections. The example is [here](conf/gauru
|keepalive_timeout|int |time for continuing keep-alive connection to GCM|90 | |
|keepalive_conns |int |number of keep-alive connection to GCM |runtime.NumCPU()||
|retry_max |int |maximum retry count for push notication to GCM |1 | |
|use_fcm |bool |Use FCM endpoint instead of GCM (by default, `gaurun` uses GCM endpoint) |false | |
|use_fcm |bool |Use FCM endpoint instead of GCM (by default, `gaurun` uses FCM endpoint) |true | |

## Log Section

Expand Down
10 changes: 5 additions & 5 deletions gaurun/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ func keepAliveInterval(keepAliveTimeout int) int {

// InitGCMClient initializes GCMClient which is globally declared.
func InitGCMClient() error {
// By default, use GCM endpoint. If UseFCM is explicitly enabled via configuration,
// use FCM endpoint.
url := gcm.GCMSendEndpoint
if ConfGaurun.Android.UseFCM {
url = gcm.FCMSendEndpoint
// By default, use FCM endpoint. If UseFCM is explicitly disabled via configuration,
// use GCM endpoint.
url := gcm.FCMSendEndpoint
if !ConfGaurun.Android.UseFCM {
url = gcm.GCMSendEndpoint
}

var err error
Expand Down
2 changes: 1 addition & 1 deletion gaurun/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func BuildDefaultConf() ConfToml {
conf.Android.KeepAliveTimeout = 90
conf.Android.KeepAliveConns = numCPU
conf.Android.RetryMax = 1
conf.Android.UseFCM = false
conf.Android.UseFCM = true
// iOS
conf.Ios.Enabled = true
conf.Ios.PemCertPath = ""
Expand Down
2 changes: 1 addition & 1 deletion gaurun/conf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (suite *ConfigTestSuite) TestValidateConfDefault() {
assert.Equal(suite.T(), suite.ConfGaurunDefault.Android.KeepAliveTimeout, 90)
assert.Equal(suite.T(), int64(suite.ConfGaurunDefault.Android.KeepAliveConns), suite.ConfGaurunDefault.Core.WorkerNum)
assert.Equal(suite.T(), suite.ConfGaurunDefault.Android.RetryMax, 1)
assert.Equal(suite.T(), suite.ConfGaurunDefault.Android.UseFCM, false)
assert.Equal(suite.T(), suite.ConfGaurunDefault.Android.UseFCM, true)
// Ios
assert.Equal(suite.T(), suite.ConfGaurunDefault.Ios.Enabled, true)
assert.Equal(suite.T(), suite.ConfGaurunDefault.Ios.PemCertPath, "")
Expand Down