Skip to content

Commit 8b832b6

Browse files
authored
cassandra: parse port from url to set cluster’s port
1 parent c378583 commit 8b832b6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

database/cassandra/cassandra.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,14 @@ func (c *Cassandra) Open(url string) (database.Driver, error) {
125125
}
126126
cluster.ProtoVersion = protoversion
127127
}
128+
if len(u.Query().Get("port")) > 0 {
129+
var port int
130+
port, err = strconv.Atoi(u.Query().Get("port"))
131+
if err != nil {
132+
return nil, err
133+
}
134+
cluster.Port = port
135+
}
128136
if len(u.Query().Get("timeout")) > 0 {
129137
var timeout time.Duration
130138
timeout, err = time.ParseDuration(u.Query().Get("timeout"))

0 commit comments

Comments
 (0)