Raise the error levels for wrong flag

If the notification url configuration is known to be not working,
this should be raised as an error, not a warning.

Without this, it would be easy to miss a misconfiguration.

Signed-off-by: Jean-Philippe Evrard <open-source@a.spamming.party>
This commit is contained in:
Jean-Philippe Evrard
2024-10-09 20:32:28 +02:00
parent a8132a2286
commit aae5bb6ebb

View File

@@ -313,11 +313,11 @@ func validateNotificationURL(notifyURL string, slackHookURL string) string {
log.Warnf("Deprecated flag(s). Please use --notify-url flag instead.")
parsedURL, err := url.Parse(stripQuotes(slackHookURL))
if err != nil {
log.Warnf("slack-hook-url is not properly formatted... no notification will be sent: %v\n", err)
log.Errorf("slack-hook-url is not properly formatted... no notification will be sent: %v\n", err)
return ""
}
if len(strings.Split(strings.Trim(parsedURL.Path, "/services/"), "/")) != 3 {
log.Warnf("slack-hook-url is not properly formatted... no notification will be sent: unexpected number of / in URL\n")
log.Errorf("slack-hook-url is not properly formatted... no notification will be sent: unexpected number of / in URL\n")
return ""
}
return fmt.Sprintf("slack://%s", strings.Trim(parsedURL.Path, "/services/"))