mirror of
https://github.com/TwiN/gatus.git
synced 2024-11-25 09:24:04 +01:00
put property name back as originator and recipients
This commit is contained in:
parent
c5e2b0f159
commit
199f14667e
@ -129,8 +129,8 @@ Note that you can also add environment variables in the configuration file (i.e.
|
|||||||
| `alerting.mattermost.insecure` | Whether to skip verifying the server's certificate chain and host name | `false` |
|
| `alerting.mattermost.insecure` | Whether to skip verifying the server's certificate chain and host name | `false` |
|
||||||
| `alerting.messagebird` | Settings for alerts of type `messagebird` | `{}` |
|
| `alerting.messagebird` | Settings for alerts of type `messagebird` | `{}` |
|
||||||
| `alerting.messagebird.access-key` | Messagebird access key | Required `""` |
|
| `alerting.messagebird.access-key` | Messagebird access key | Required `""` |
|
||||||
| `alerting.messagebird.from` | The sender of the message | Required `""` |
|
| `alerting.messagebird.originator` | The sender of the message | Required `""` |
|
||||||
| `alerting.messagebird.to` | The recipients of the message | Required `""` |
|
| `alerting.messagebird.recipients` | The recipients of the message | Required `""` |
|
||||||
| `alerting.custom` | Configuration for custom actions on failure or alerts | `{}` |
|
| `alerting.custom` | Configuration for custom actions on failure or alerts | `{}` |
|
||||||
| `alerting.custom.url` | Custom alerting request url | Required `""` |
|
| `alerting.custom.url` | Custom alerting request url | Required `""` |
|
||||||
| `alerting.custom.method` | Request method | `GET` |
|
| `alerting.custom.method` | Request method | `GET` |
|
||||||
@ -319,8 +319,8 @@ Example of sending **sms** message alert by using Messagebird
|
|||||||
alerting:
|
alerting:
|
||||||
messagebird:
|
messagebird:
|
||||||
access-key: "..."
|
access-key: "..."
|
||||||
from: "31619191918"
|
originator: "31619191918"
|
||||||
to: "31619191919,31619191920"
|
recipients: "31619191919,31619191920"
|
||||||
services:
|
services:
|
||||||
- name: twinnation
|
- name: twinnation
|
||||||
interval: 30s
|
interval: 30s
|
||||||
|
@ -15,13 +15,13 @@ const (
|
|||||||
// AlertProvider is the configuration necessary for sending an alert using Messagebird
|
// AlertProvider is the configuration necessary for sending an alert using Messagebird
|
||||||
type AlertProvider struct {
|
type AlertProvider struct {
|
||||||
AccessKey string `yaml:"access-key"`
|
AccessKey string `yaml:"access-key"`
|
||||||
From string `yaml:"from"`
|
Originator string `yaml:"originator"`
|
||||||
To string `yaml:"to"`
|
Recipients string `yaml:"recipients"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsValid returns whether the provider's configuration is valid
|
// IsValid returns whether the provider's configuration is valid
|
||||||
func (provider *AlertProvider) IsValid() bool {
|
func (provider *AlertProvider) IsValid() bool {
|
||||||
return len(provider.AccessKey) > 0 && len(provider.From) > 0 && len(provider.To) > 0
|
return len(provider.AccessKey) > 0 && len(provider.Originator) > 0 && len(provider.Recipients) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToCustomAlertProvider converts the provider into a custom.AlertProvider
|
// ToCustomAlertProvider converts the provider into a custom.AlertProvider
|
||||||
@ -41,7 +41,7 @@ func (provider *AlertProvider) ToCustomAlertProvider(service *core.Service, aler
|
|||||||
"originator": "%s",
|
"originator": "%s",
|
||||||
"recipients": "%s",
|
"recipients": "%s",
|
||||||
"body": "%s"
|
"body": "%s"
|
||||||
}`, provider.From, provider.To, message),
|
}`, provider.Originator, provider.Recipients, message),
|
||||||
Headers: map[string]string{
|
Headers: map[string]string{
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"Authorization": fmt.Sprintf("AccessKey %s", provider.AccessKey),
|
"Authorization": fmt.Sprintf("AccessKey %s", provider.AccessKey),
|
||||||
|
@ -14,8 +14,8 @@ func TestMessagebirdAlertProvider_IsValid(t *testing.T) {
|
|||||||
}
|
}
|
||||||
validProvider := AlertProvider{
|
validProvider := AlertProvider{
|
||||||
AccessKey: "1",
|
AccessKey: "1",
|
||||||
From: "1",
|
Originator: "1",
|
||||||
To: "1",
|
Recipients: "1",
|
||||||
}
|
}
|
||||||
if !validProvider.IsValid() {
|
if !validProvider.IsValid() {
|
||||||
t.Error("provider should've been valid")
|
t.Error("provider should've been valid")
|
||||||
@ -25,8 +25,8 @@ func TestMessagebirdAlertProvider_IsValid(t *testing.T) {
|
|||||||
func TestAlertProvider_ToCustomAlertProviderWithResolvedAlert(t *testing.T) {
|
func TestAlertProvider_ToCustomAlertProviderWithResolvedAlert(t *testing.T) {
|
||||||
provider := AlertProvider{
|
provider := AlertProvider{
|
||||||
AccessKey: "1",
|
AccessKey: "1",
|
||||||
From: "1",
|
Originator: "1",
|
||||||
To: "1",
|
Recipients: "1",
|
||||||
}
|
}
|
||||||
customAlertProvider := provider.ToCustomAlertProvider(&core.Service{}, &core.Alert{}, &core.Result{}, true)
|
customAlertProvider := provider.ToCustomAlertProvider(&core.Service{}, &core.Alert{}, &core.Result{}, true)
|
||||||
if customAlertProvider == nil {
|
if customAlertProvider == nil {
|
||||||
@ -40,8 +40,8 @@ func TestAlertProvider_ToCustomAlertProviderWithResolvedAlert(t *testing.T) {
|
|||||||
func TestAlertProvider_ToCustomAlertProviderWithTriggeredAlert(t *testing.T) {
|
func TestAlertProvider_ToCustomAlertProviderWithTriggeredAlert(t *testing.T) {
|
||||||
provider := AlertProvider{
|
provider := AlertProvider{
|
||||||
AccessKey: "1",
|
AccessKey: "1",
|
||||||
From: "1",
|
Originator: "1",
|
||||||
To: "1",
|
Recipients: "1",
|
||||||
}
|
}
|
||||||
customAlertProvider := provider.ToCustomAlertProvider(&core.Service{}, &core.Alert{}, &core.Result{}, false)
|
customAlertProvider := provider.ToCustomAlertProvider(&core.Service{}, &core.Alert{}, &core.Result{}, false)
|
||||||
if customAlertProvider == nil {
|
if customAlertProvider == nil {
|
||||||
|
@ -416,11 +416,11 @@ services:
|
|||||||
if config.Alerting.Messagebird.AccessKey != "1" {
|
if config.Alerting.Messagebird.AccessKey != "1" {
|
||||||
t.Errorf("Messagebird access key should've been %s, but was %s", "1", config.Alerting.Messagebird.AccessKey)
|
t.Errorf("Messagebird access key should've been %s, but was %s", "1", config.Alerting.Messagebird.AccessKey)
|
||||||
}
|
}
|
||||||
if config.Alerting.Messagebird.From != "31619191918" {
|
if config.Alerting.Messagebird.Originator != "31619191918" {
|
||||||
t.Errorf("Messagebird from field should've been %s, but was %s", "31619191918", config.Alerting.Messagebird.From)
|
t.Errorf("Messagebird originator field should've been %s, but was %s", "31619191918", config.Alerting.Messagebird.Originator)
|
||||||
}
|
}
|
||||||
if config.Alerting.Messagebird.To != "31619191919" {
|
if config.Alerting.Messagebird.Recipients != "31619191919" {
|
||||||
t.Errorf("Messagebird to field should've been %s, but was %s", "31619191919", config.Alerting.Messagebird.To)
|
t.Errorf("Messagebird to recipients should've been %s, but was %s", "31619191919", config.Alerting.Messagebird.Recipients)
|
||||||
}
|
}
|
||||||
if len(config.Services) != 1 {
|
if len(config.Services) != 1 {
|
||||||
t.Error("There should've been 1 service")
|
t.Error("There should've been 1 service")
|
||||||
|
Loading…
Reference in New Issue
Block a user