docker-db-backup/webhook.go
kolaente 07c2fae209
All checks were successful
continuous-integration/drone/push Build is passing
feat: add completion webhook url
2023-06-05 18:35:21 +02:00

27 lines
449 B
Go

package main
import (
"bytes"
"fmt"
"net/http"
)
func callWebhook() error {
if config.CompletionWebhookURL == "" {
return nil
}
res, err := http.Get(config.CompletionWebhookURL)
if err != nil {
return err
}
if res.StatusCode > 399 {
buf := bytes.Buffer{}
_, _ = buf.ReadFrom(res.Body)
return fmt.Errorf("recived an error status code while calling the webhook: %d, message: %s", res.StatusCode, buf.String())
}
return nil
}