Skip to content

Commit

Permalink
Merge pull request #5 from mindhash/amol/test-channel-pagerduty
Browse files Browse the repository at this point in the history
(bug): added pagerduty events URL to testReceiver
  • Loading branch information
ankitnayan committed Apr 27, 2022
2 parents 83adfdd + 42240ac commit 6f8c41a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/v1/config_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ func (api *API) testReceiver(w http.ResponseWriter, req *http.Request) {
return ctx
}

// used to get default URLs like in case of pagerduty
defaultGlobalConfig := config.DefaultGlobalConfig()

if receiver.WebhookConfigs != nil {
notifier, err := webhook.New(receiver.WebhookConfigs[0], tmpl, api.logger)
if err != nil {
Expand Down Expand Up @@ -245,6 +248,7 @@ func (api *API) testReceiver(w http.ResponseWriter, req *http.Request) {
} else if receiver.PagerdutyConfigs != nil {
pc := receiver.PagerdutyConfigs[0]
pc.HTTPConfig = &commoncfg.HTTPClientConfig{}
pc.URL = defaultGlobalConfig.PagerdutyURL
notifier, err := pagerduty.New(pc, tmpl, api.logger)
if err != nil {
api.respondError(w, apiError{err: err, typ: errorInternal}, "failed to prepare message for select config")
Expand Down

0 comments on commit 6f8c41a

Please sign in to comment.