mirror of
https://github.com/TwiN/gatus.git
synced 2024-12-15 17:51:09 +00:00
fix(alerting): Make Microsoft Teams title customizable (#731)
* Teams Custom Title * Update README.md * Small adjustment --------- Co-authored-by: TwiN <twin@linux.com>
This commit is contained in:
parent
dcfdfd423e
commit
739e6c75a6
2 changed files with 16 additions and 9 deletions
|
@ -1134,11 +1134,12 @@ Here's an example of what the notifications look like:
|
||||||
|
|
||||||
#### Configuring Teams alerts
|
#### Configuring Teams alerts
|
||||||
| Parameter | Description | Default |
|
| Parameter | Description | Default |
|
||||||
|:-----------------------------------------|:-------------------------------------------------------------------------------------------|:--------------|
|
|:-----------------------------------------|:-------------------------------------------------------------------------------------------|:--------------------|
|
||||||
| `alerting.teams` | Configuration for alerts of type `teams` | `{}` |
|
| `alerting.teams` | Configuration for alerts of type `teams` | `{}` |
|
||||||
| `alerting.teams.webhook-url` | Teams Webhook URL | Required `""` |
|
| `alerting.teams.webhook-url` | Teams Webhook URL | Required `""` |
|
||||||
| `alerting.teams.default-alert` | Default alert configuration. <br />See [Setting a default alert](#setting-a-default-alert) | N/A |
|
| `alerting.teams.default-alert` | Default alert configuration. <br />See [Setting a default alert](#setting-a-default-alert) | N/A |
|
||||||
| `alerting.teams.overrides` | List of overrides that may be prioritized over the default configuration | `[]` |
|
| `alerting.teams.overrides` | List of overrides that may be prioritized over the default configuration | `[]` |
|
||||||
|
| `alerting.teams.title` | Title of the notification | `"🚨 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 | `""` |
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,9 @@ type AlertProvider struct {
|
||||||
|
|
||||||
// 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"`
|
||||||
|
|
||||||
|
// Title is the title of the message that will be sent
|
||||||
|
Title string `yaml:"title,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Override is a case under which the default integration is overridden
|
// Override is a case under which the default integration is overridden
|
||||||
|
@ -105,9 +108,12 @@ func (provider *AlertProvider) buildRequestBody(endpoint *core.Endpoint, alert *
|
||||||
Type: "MessageCard",
|
Type: "MessageCard",
|
||||||
Context: "http://schema.org/extensions",
|
Context: "http://schema.org/extensions",
|
||||||
ThemeColor: color,
|
ThemeColor: color,
|
||||||
Title: "🚨 Gatus",
|
Title: provider.Title,
|
||||||
Text: message + description,
|
Text: message + description,
|
||||||
}
|
}
|
||||||
|
if len(body.Title) == 0 {
|
||||||
|
body.Title = "🚨 Gatus"
|
||||||
|
}
|
||||||
if len(formattedConditionResults) > 0 {
|
if len(formattedConditionResults) > 0 {
|
||||||
body.Sections = append(body.Sections, Section{
|
body.Sections = append(body.Sections, Section{
|
||||||
ActivityTitle: "Condition results",
|
ActivityTitle: "Condition results",
|
||||||
|
|
Loading…
Reference in a new issue