Close #14: Support skipping certificate verification (services[].insecure)

This commit is contained in:
TwinProduction
2020-10-04 17:01:10 -04:00
parent ed490669b1
commit 6a3f65db7f
5 changed files with 46 additions and 13 deletions

View File

@ -46,6 +46,9 @@ type Service struct {
// Alerts is the alerting configuration for the service in case of failure
Alerts []*Alert `yaml:"alerts"`
// Insecure is whether to skip verifying the server's certificate chain and host name
Insecure bool `yaml:"insecure,omitempty"`
NumberOfFailuresInARow int
NumberOfSuccessesInARow int
}
@ -135,7 +138,7 @@ func (service *Service) getIp(result *Result) {
func (service *Service) call(result *Result) {
request := service.buildRequest()
startTime := time.Now()
response, err := client.GetHttpClient().Do(request)
response, err := client.GetHttpClient(service.Insecure).Do(request)
if err != nil {
result.Duration = time.Since(startTime)
result.Errors = append(result.Errors, err.Error())