Skip to content

Commit

Permalink
Change default token-prefix to proper one for the Alerta service
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianCzoch committed Nov 14, 2018
1 parent e58f95a commit f075b83
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ alert will auto-recover.
### Bugfixes

- [#1834](https://github.com/influxdata/kapacitor/issues/1834): Fix bug where task type was invalid when using var for stream/batch
## Unreleased

### Bugfixes

- [#1165]((https://github.com/influxdata/kapacitor/issues/1165): Fix wrong default "token-prefix" value for the alerta service.

## v1.4.0 [2017-12-08]

Expand Down
3 changes: 1 addition & 2 deletions etc/kapacitor/kapacitor.conf
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,7 @@ default-retention-policy = ""
# Default authentication token.
token = ""
# Default token prefix
# If you are on older versions of alerta you may need to change this to "Key"
token-prefix = "Bearer"
token-prefix = "Key"
# Default environment.
environment = ""
# Default origin.
Expand Down
4 changes: 2 additions & 2 deletions integrations/streamer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8864,7 +8864,7 @@ stream
exp := []interface{}{
alertatest.Request{
URL: "/alert",
Authorization: "Bearer testtoken1234567",
Authorization: "Key testtoken1234567",
PostData: alertatest.PostData{
Resource: "cpu",
Event: "serverA",
Expand All @@ -8878,7 +8878,7 @@ stream
},
alertatest.Request{
URL: "/alert",
Authorization: "Bearer anothertesttoken",
Authorization: "Key anothertesttoken",
PostData: alertatest.PostData{
Resource: "resource: serverA",
Event: "event: TestStream_Alert",
Expand Down
4 changes: 2 additions & 2 deletions server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9474,7 +9474,7 @@ func TestServer_AlertHandlers(t *testing.T) {
Kind: "alerta",
Options: map[string]interface{}{
"token": "testtoken1234567",
"token-prefix": "Bearer",
"token-prefix": "Key",
"origin": "kapacitor",
"group": "test",
"environment": "env",
Expand All @@ -9495,7 +9495,7 @@ func TestServer_AlertHandlers(t *testing.T) {
got := ts.Requests()
exp := []alertatest.Request{{
URL: "/alert",
Authorization: "Bearer testtoken1234567",
Authorization: "Key testtoken1234567",
PostData: alertatest.PostData{
Resource: "alert",
Event: "id",
Expand Down
2 changes: 1 addition & 1 deletion services/alerta/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type Config struct {
// The authentication token for this notification, can be overridden per alert.
Token string `toml:"token" override:"token,redact"`
// The prefix for the Authentication field where the token is stored
// This defaults to Bearer but you may need to set this to "Key" for older versions of alerta
// This defaults to Key
TokenPrefix string `toml:"token-prefix" override:"token-prefix"`
// The environment in which to raise the alert.
Environment string `toml:"environment" override:"environment"`
Expand Down
2 changes: 1 addition & 1 deletion services/alerta/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const (
defaultEvent = "{{ .ID }}"
defaultGroup = "{{ .Group }}"
defaultTimeout = time.Duration(24 * time.Hour)
defaultTokenPrefix = "Bearer"
defaultTokenPrefix = "Key"
)

type Diagnostic interface {
Expand Down

0 comments on commit f075b83

Please sign in to comment.