mirror of
https://github.com/TwiN/gatus.git
synced 2024-11-21 23:43:27 +01:00
Remove deprecated parameters from alerting providers
This commit is contained in:
parent
66e312b72f
commit
7c9e2742c1
@ -5,7 +5,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
@ -20,7 +19,6 @@ import (
|
|||||||
type AlertProvider struct {
|
type AlertProvider struct {
|
||||||
URL string `yaml:"url"`
|
URL string `yaml:"url"`
|
||||||
Method string `yaml:"method,omitempty"`
|
Method string `yaml:"method,omitempty"`
|
||||||
Insecure bool `yaml:"insecure,omitempty"` // deprecated
|
|
||||||
Body string `yaml:"body,omitempty"`
|
Body string `yaml:"body,omitempty"`
|
||||||
Headers map[string]string `yaml:"headers,omitempty"`
|
Headers map[string]string `yaml:"headers,omitempty"`
|
||||||
Placeholders map[string]map[string]string `yaml:"placeholders,omitempty"`
|
Placeholders map[string]map[string]string `yaml:"placeholders,omitempty"`
|
||||||
@ -36,11 +34,6 @@ type AlertProvider struct {
|
|||||||
func (provider *AlertProvider) IsValid() bool {
|
func (provider *AlertProvider) IsValid() bool {
|
||||||
if provider.ClientConfig == nil {
|
if provider.ClientConfig == nil {
|
||||||
provider.ClientConfig = client.GetDefaultConfig()
|
provider.ClientConfig = client.GetDefaultConfig()
|
||||||
// XXX: remove the next 4 lines in v3.0.0
|
|
||||||
if provider.Insecure {
|
|
||||||
log.Println("WARNING: alerting.*.insecure has been deprecated and will be removed in v3.0.0 in favor of alerting.*.client.insecure")
|
|
||||||
provider.ClientConfig.Insecure = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return len(provider.URL) > 0 && provider.ClientConfig != nil
|
return len(provider.URL) > 0 && provider.ClientConfig != nil
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package mattermost
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/TwinProduction/gatus/alerting/alert"
|
"github.com/TwinProduction/gatus/alerting/alert"
|
||||||
@ -14,7 +13,6 @@ import (
|
|||||||
// AlertProvider is the configuration necessary for sending an alert using Mattermost
|
// AlertProvider is the configuration necessary for sending an alert using Mattermost
|
||||||
type AlertProvider struct {
|
type AlertProvider struct {
|
||||||
WebhookURL string `yaml:"webhook-url"`
|
WebhookURL string `yaml:"webhook-url"`
|
||||||
Insecure bool `yaml:"insecure,omitempty"` // deprecated
|
|
||||||
|
|
||||||
// ClientConfig is the configuration of the client used to communicate with the provider's target
|
// ClientConfig is the configuration of the client used to communicate with the provider's target
|
||||||
ClientConfig *client.Config `yaml:"client"`
|
ClientConfig *client.Config `yaml:"client"`
|
||||||
@ -27,11 +25,6 @@ type AlertProvider struct {
|
|||||||
func (provider *AlertProvider) IsValid() bool {
|
func (provider *AlertProvider) IsValid() bool {
|
||||||
if provider.ClientConfig == nil {
|
if provider.ClientConfig == nil {
|
||||||
provider.ClientConfig = client.GetDefaultConfig()
|
provider.ClientConfig = client.GetDefaultConfig()
|
||||||
// XXX: remove the next 3 lines in v3.0.0
|
|
||||||
if provider.Insecure {
|
|
||||||
log.Println("WARNING: alerting.mattermost.insecure has been deprecated and will be removed in v3.0.0 in favor of alerting.mattermost.client.insecure")
|
|
||||||
provider.ClientConfig.Insecure = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return len(provider.WebhookURL) > 0
|
return len(provider.WebhookURL) > 0
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user