From a6a7f6c747f5361cda38e04e6016f7fe9bb48a23 Mon Sep 17 00:00:00 2001 From: Joachim Danmayr <46405460+joda01@users.noreply.github.com> Date: Tue, 15 Oct 2024 14:40:41 +0200 Subject: [PATCH] chore: If url is +srv no port is allowed --- backends/mongo.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backends/mongo.go b/backends/mongo.go index 420ad68..4e94197 100644 --- a/backends/mongo.go +++ b/backends/mongo.go @@ -114,7 +114,12 @@ func NewMongo(authOpts map[string]string, logLevel log.Level, hasher hashing.Has m.insecureSkipVerify = true } - addr := fmt.Sprintf("%s://%s:%s", m.HostPrefix, m.Host, m.Port) + var addr = "" + if m.HostPrefix != "mongodb+srv" { + addr = fmt.Sprintf("%s://%s:%s", m.HostPrefix, m.Host, m.Port) + } else { + addr = fmt.Sprintf("%s://%s", m.HostPrefix, m.Host) + } to := 60 * time.Second