From 8b832b6275bd43ff9aeb771d113f37a8d9a65df1 Mon Sep 17 00:00:00 2001 From: Margarita Naumenko <53599412+hessayon@users.noreply.github.com> Date: Tue, 3 Dec 2024 12:15:51 +0300 Subject: [PATCH] =?UTF-8?q?cassandra:=20parse=20port=20from=20url=20to=20s?= =?UTF-8?q?et=20cluster=E2=80=99s=20port?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- database/cassandra/cassandra.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/database/cassandra/cassandra.go b/database/cassandra/cassandra.go index 74eecc98e..88d3eeea6 100644 --- a/database/cassandra/cassandra.go +++ b/database/cassandra/cassandra.go @@ -125,6 +125,14 @@ func (c *Cassandra) Open(url string) (database.Driver, error) { } cluster.ProtoVersion = protoversion } + if len(u.Query().Get("port")) > 0 { + var port int + port, err = strconv.Atoi(u.Query().Get("port")) + if err != nil { + return nil, err + } + cluster.Port = port + } if len(u.Query().Get("timeout")) > 0 { var timeout time.Duration timeout, err = time.ParseDuration(u.Query().Get("timeout"))