feat(alerting): alert teams add client insecure option (#864)

* feat: alert teams add client insecure option

* feat(docs): add comment for `ClientConfig` field

* fix typo

---------

Co-authored-by: raojinlin <raojinlin302@gmail.com>
Co-authored-by: TwiN <twin@linux.com>
This commit is contained in:
raojinlin 2024-09-22 08:26:30 +08:00 committed by GitHub
parent de2d41ed88
commit fc09981779
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View File

@ -1182,11 +1182,14 @@ Here's an example of what the notifications look like:
| `alerting.teams.title` | Title of the notification | `"&#x1F6A8; Gatus"` | | `alerting.teams.title` | Title of the notification | `"&#x1F6A8; Gatus"` |
| `alerting.teams.overrides[].group` | Endpoint group for which the configuration will be overridden by this configuration | `""` | | `alerting.teams.overrides[].group` | Endpoint group for which the configuration will be overridden by this configuration | `""` |
| `alerting.teams.overrides[].webhook-url` | Teams Webhook URL | `""` | | `alerting.teams.overrides[].webhook-url` | Teams Webhook URL | `""` |
| `alerting.teams.client.insecure` | Whether to skip TLS verification | `false` |
```yaml ```yaml
alerting: alerting:
teams: teams:
webhook-url: "https://********.webhook.office.com/webhookb2/************" webhook-url: "https://********.webhook.office.com/webhookb2/************"
client:
insecure: false
# You can also add group-specific to keys, which will # You can also add group-specific to keys, which will
# override the to key above for the specified groups # override the to key above for the specified groups
overrides: overrides:

View File

@ -19,6 +19,9 @@ type AlertProvider struct {
// DefaultAlert is the default alert configuration to use for endpoints with an alert of the appropriate type // DefaultAlert is the default alert configuration to use for endpoints with an alert of the appropriate type
DefaultAlert *alert.Alert `yaml:"default-alert,omitempty"` DefaultAlert *alert.Alert `yaml:"default-alert,omitempty"`
// ClientConfig is the configuration of the client used to communicate with the provider's target
ClientConfig *client.Config `yaml:"client,omitempty"`
// Overrides is a list of Override that may be prioritized over the default configuration // Overrides is a list of Override that may be prioritized over the default configuration
Overrides []Override `yaml:"overrides,omitempty"` Overrides []Override `yaml:"overrides,omitempty"`
@ -54,7 +57,7 @@ func (provider *AlertProvider) Send(ep *endpoint.Endpoint, alert *alert.Alert, r
return err return err
} }
request.Header.Set("Content-Type", "application/json") request.Header.Set("Content-Type", "application/json")
response, err := client.GetHTTPClient(nil).Do(request) response, err := client.GetHTTPClient(provider.ClientConfig).Do(request)
if err != nil { if err != nil {
return err return err
} }