Skip to content

Commit

Permalink
update: support tls for lower level driver when url is from clickhous…
Browse files Browse the repository at this point in the history
…e.cloud
  • Loading branch information
riccardo-gnosis committed Aug 30, 2024
1 parent c92e396 commit 52fa91f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pkg/db/low_level_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package db

import (
"context"
"crypto/tls"
"strings"
"time"

Expand Down Expand Up @@ -47,11 +48,18 @@ func ParseChUrlIntoOptionsLowLevel(url string) ch.Options {
user = strings.Split(credentials, ":")[0]
password = strings.Split(credentials, ":")[1]

return ch.Options{
options := ch.Options{
Address: fqdn,
Database: database,
User: user,
Password: password}
Password: password,
}

if strings.Contains(fqdn, "clickhouse.cloud") {
options.TLS = &tls.Config{}
}

return options
}

func (p *DBService) Persist(
Expand Down

0 comments on commit 52fa91f

Please sign in to comment.