add max retry flag.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
		
							parent
							
								
									731c35baa6
								
							
						
					
					
						commit
						411f413484
					
				|  | @ -44,6 +44,7 @@ type SectionAPI struct { | |||
| type SectionAndroid struct { | ||||
| 	Enabled  bool   `yaml:"enabled"` | ||||
| 	APIKey   string `yaml:"apikey"` | ||||
| 	MaxRetry int    `yaml:"max_retry"` | ||||
| } | ||||
| 
 | ||||
| // SectionIos is sub section of config.
 | ||||
|  | @ -52,6 +53,7 @@ type SectionIos struct { | |||
| 	KeyPath    string `yaml:"key_path"` | ||||
| 	Password   string `yaml:"password"` | ||||
| 	Production bool   `yaml:"production"` | ||||
| 	MaxRetry   int    `yaml:"max_retry"` | ||||
| } | ||||
| 
 | ||||
| // SectionLog is sub section of config.
 | ||||
|  | @ -131,12 +133,14 @@ func BuildDefaultPushConf() ConfYaml { | |||
| 	// Android
 | ||||
| 	conf.Android.Enabled = false | ||||
| 	conf.Android.APIKey = "" | ||||
| 	conf.Android.MaxRetry = 1 | ||||
| 
 | ||||
| 	// iOS
 | ||||
| 	conf.Ios.Enabled = false | ||||
| 	conf.Ios.KeyPath = "key.pem" | ||||
| 	conf.Ios.Password = "" | ||||
| 	conf.Ios.Production = false | ||||
| 	conf.Ios.MaxRetry = 1 | ||||
| 
 | ||||
| 	// log
 | ||||
| 	conf.Log.Format = "string" | ||||
|  |  | |||
|  | @ -23,12 +23,14 @@ api: | |||
| android: | ||||
|   enabled: true | ||||
|   apikey: "YOUR_API_KEY" | ||||
|   max_retry: 1 | ||||
| 
 | ||||
| ios: | ||||
|   enabled: false | ||||
|   key_path: "key.pem" | ||||
|   password: "" | ||||
|   production: false | ||||
|   max_retry: 1 | ||||
| 
 | ||||
| log: | ||||
|   format: "string" # string or json | ||||
|  |  | |||
|  | @ -78,12 +78,14 @@ func (suite *ConfigTestSuite) TestValidateConfDefault() { | |||
| 	// Android
 | ||||
| 	assert.Equal(suite.T(), false, suite.ConfGorushDefault.Android.Enabled) | ||||
| 	assert.Equal(suite.T(), "", suite.ConfGorushDefault.Android.APIKey) | ||||
| 	assert.Equal(suite.T(), 1, suite.ConfGorushDefault.Android.MaxRetry) | ||||
| 
 | ||||
| 	// iOS
 | ||||
| 	assert.Equal(suite.T(), false, suite.ConfGorushDefault.Ios.Enabled) | ||||
| 	assert.Equal(suite.T(), "key.pem", suite.ConfGorushDefault.Ios.KeyPath) | ||||
| 	assert.Equal(suite.T(), "", suite.ConfGorushDefault.Ios.Password) | ||||
| 	assert.Equal(suite.T(), false, suite.ConfGorushDefault.Ios.Production) | ||||
| 	assert.Equal(suite.T(), 1, suite.ConfGorushDefault.Ios.MaxRetry) | ||||
| 
 | ||||
| 	// log
 | ||||
| 	assert.Equal(suite.T(), "string", suite.ConfGorushDefault.Log.Format) | ||||
|  | @ -131,12 +133,14 @@ func (suite *ConfigTestSuite) TestValidateConf() { | |||
| 	// Android
 | ||||
| 	assert.Equal(suite.T(), true, suite.ConfGorush.Android.Enabled) | ||||
| 	assert.Equal(suite.T(), "YOUR_API_KEY", suite.ConfGorush.Android.APIKey) | ||||
| 	assert.Equal(suite.T(), 1, suite.ConfGorush.Android.MaxRetry) | ||||
| 
 | ||||
| 	// iOS
 | ||||
| 	assert.Equal(suite.T(), false, suite.ConfGorush.Ios.Enabled) | ||||
| 	assert.Equal(suite.T(), "key.pem", suite.ConfGorush.Ios.KeyPath) | ||||
| 	assert.Equal(suite.T(), "", suite.ConfGorush.Ios.Password) | ||||
| 	assert.Equal(suite.T(), false, suite.ConfGorush.Ios.Production) | ||||
| 	assert.Equal(suite.T(), 1, suite.ConfGorush.Ios.MaxRetry) | ||||
| 
 | ||||
| 	// log
 | ||||
| 	assert.Equal(suite.T(), "string", suite.ConfGorush.Log.Format) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue