vmalert: remove trailing slash for static notifier addresses

This would make addresses `http://localhost:9093` and `http://localhost:9093/`
both to result into `http://localhost:9093/api/v2/alerts`.

Signed-off-by: hagen1778 <roman@victoriametrics.com>
This commit is contained in:
hagen1778 2022-02-02 16:18:40 +02:00 committed by Aliaksandr Valialkin
parent 2a3a62dc41
commit 605de7bdd6
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1

View file

@ -3,6 +3,7 @@ package notifier
import (
"flag"
"fmt"
"strings"
"time"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/flagutil"
@ -93,6 +94,7 @@ func notifiersFromFlags(gen AlertURLGenerator) ([]Notifier, error) {
Password: promauth.NewSecret(basicAuthPassword.GetOptionalArg(i)),
},
}
addr = strings.TrimSuffix(addr, "/")
am, err := NewAlertManager(addr+alertManagerPath, gen, authCfg, time.Minute)
if err != nil {
return nil, err