From aab92e4c0775b5ff89e737dda85d7fe7802a6402 Mon Sep 17 00:00:00 2001 From: catatsuy Date: Wed, 27 Jun 2018 12:35:43 +0900 Subject: [PATCH] change the default value of use_fcm to true refs #93 --- CONFIGURATION.md | 2 +- gaurun/client.go | 10 +++++----- gaurun/conf.go | 2 +- gaurun/conf_test.go | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CONFIGURATION.md b/CONFIGURATION.md index a8966f2..7ae9014 100644 --- a/CONFIGURATION.md +++ b/CONFIGURATION.md @@ -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 diff --git a/gaurun/client.go b/gaurun/client.go index 8a3a015..f139609 100644 --- a/gaurun/client.go +++ b/gaurun/client.go @@ -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 diff --git a/gaurun/conf.go b/gaurun/conf.go index 5a7184e..8ecb395 100644 --- a/gaurun/conf.go +++ b/gaurun/conf.go @@ -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 = "" diff --git a/gaurun/conf_test.go b/gaurun/conf_test.go index 6c896d7..a3f71a2 100644 --- a/gaurun/conf_test.go +++ b/gaurun/conf_test.go @@ -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, "")