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 Nikolay
parent 5da71eb685
commit f57982eddc

View file

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