feat: add async feedback hook option (#414)
* feat: add async feedback hook option * remove unnecessary return values * review: check feedback's resp state * fix embedmd error * fix config test * add feedback tests * fix errcheck issues
This commit is contained in:
@@ -19,6 +19,7 @@ core:
|
||||
queue_num: 0 # default queue number is 8192
|
||||
max_notification: 100
|
||||
sync: false # set true if you need get error message from fail push notification in API response.
|
||||
feedback_hook_url: "" # set webhook url if you need get error message asynchronously from fail push notification in API response.
|
||||
mode: "release"
|
||||
ssl: false
|
||||
cert_path: "cert.pem"
|
||||
@@ -114,6 +115,7 @@ type SectionCore struct {
|
||||
CertBase64 string `yaml:"cert_base64"`
|
||||
KeyBase64 string `yaml:"key_base64"`
|
||||
HTTPProxy string `yaml:"http_proxy"`
|
||||
FeedbackURL string `yaml:"feedback_hook_url"`
|
||||
PID SectionPID `yaml:"pid"`
|
||||
AutoTLS SectionAutoTLS `yaml:"auto_tls"`
|
||||
}
|
||||
@@ -256,6 +258,7 @@ func LoadConf(confPath string) (ConfYaml, error) {
|
||||
conf.Core.QueueNum = int64(viper.GetInt("core.queue_num"))
|
||||
conf.Core.Mode = viper.GetString("core.mode")
|
||||
conf.Core.Sync = viper.GetBool("core.sync")
|
||||
conf.Core.FeedbackURL = viper.GetString("core.feedback_hook_url")
|
||||
conf.Core.SSL = viper.GetBool("core.ssl")
|
||||
conf.Core.CertPath = viper.GetString("core.cert_path")
|
||||
conf.Core.KeyPath = viper.GetString("core.key_path")
|
||||
|
||||
@@ -44,6 +44,7 @@ func (suite *ConfigTestSuite) TestValidateConfDefault() {
|
||||
assert.Equal(suite.T(), int64(8192), suite.ConfGorushDefault.Core.QueueNum)
|
||||
assert.Equal(suite.T(), "release", suite.ConfGorushDefault.Core.Mode)
|
||||
assert.Equal(suite.T(), false, suite.ConfGorushDefault.Core.Sync)
|
||||
assert.Equal(suite.T(), "", suite.ConfGorushDefault.Core.FeedbackURL)
|
||||
assert.Equal(suite.T(), false, suite.ConfGorushDefault.Core.SSL)
|
||||
assert.Equal(suite.T(), "cert.pem", suite.ConfGorushDefault.Core.CertPath)
|
||||
assert.Equal(suite.T(), "key.pem", suite.ConfGorushDefault.Core.KeyPath)
|
||||
@@ -116,6 +117,7 @@ func (suite *ConfigTestSuite) TestValidateConf() {
|
||||
assert.Equal(suite.T(), int64(8192), suite.ConfGorush.Core.QueueNum)
|
||||
assert.Equal(suite.T(), "release", suite.ConfGorush.Core.Mode)
|
||||
assert.Equal(suite.T(), false, suite.ConfGorush.Core.Sync)
|
||||
assert.Equal(suite.T(), "", suite.ConfGorush.Core.FeedbackURL)
|
||||
assert.Equal(suite.T(), false, suite.ConfGorush.Core.SSL)
|
||||
assert.Equal(suite.T(), "cert.pem", suite.ConfGorush.Core.CertPath)
|
||||
assert.Equal(suite.T(), "key.pem", suite.ConfGorush.Core.KeyPath)
|
||||
|
||||
1
config/testdata/config.yml
vendored
1
config/testdata/config.yml
vendored
@@ -6,6 +6,7 @@ core:
|
||||
queue_num: 0 # default queue number is 8192
|
||||
max_notification: 100
|
||||
sync: false # set true if you need get error message from fail push notification in API response.
|
||||
feedback_hook_url: "" # set a hook url if you need get error message asynchronously from fail push notification in API response.
|
||||
mode: "release"
|
||||
ssl: false
|
||||
cert_path: "cert.pem"
|
||||
|
||||
Reference in New Issue
Block a user