fix(notification/endpoint): remove slack token requirement

pull/14981/head
Kelvin Wang 2019-09-05 16:48:34 -04:00
parent ed01f5a16f
commit b933e007cb
2 changed files with 6 additions and 7 deletions

View File

@ -81,10 +81,7 @@ func TestValidEndpoint(t *testing.T) {
Base: goodBase,
URL: "localhost",
},
err: &influxdb.Error{
Code: influxdb.EInvalid,
Msg: "slack endpoint token is invalid",
},
err: nil,
},
{
name: "invalid slack token",

View File

@ -33,9 +33,11 @@ func (s *Slack) BackfillSecretKeys() {
// SecretFields return available secret fields.
func (s Slack) SecretFields() []influxdb.SecretField {
return []influxdb.SecretField{
s.Token,
arr := []influxdb.SecretField{}
if s.Token.Key != "" {
arr = append(arr, s.Token)
}
return arr
}
// Valid returns error if some configuration is invalid
@ -56,7 +58,7 @@ func (s Slack) Valid() error {
}
}
// TODO(desa): this requirement seems odd
if s.Token.Key != s.ID.String()+slackTokenSuffix {
if s.Token.Key != "" && s.Token.Key != s.ID.String()+slackTokenSuffix {
return &influxdb.Error{
Code: influxdb.EInvalid,
Msg: "slack endpoint token is invalid",