From 52fa91f66425900a18273c8f600f9d3e26a6ef87 Mon Sep 17 00:00:00 2001 From: riccardo <106812074+riccardo-gnosis@users.noreply.github.com> Date: Fri, 30 Aug 2024 16:26:10 +0200 Subject: [PATCH] update: support tls for lower level driver when url is from clickhouse.cloud --- pkg/db/low_level_driver.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/db/low_level_driver.go b/pkg/db/low_level_driver.go index c5134118..ec16f367 100644 --- a/pkg/db/low_level_driver.go +++ b/pkg/db/low_level_driver.go @@ -2,6 +2,7 @@ package db import ( "context" + "crypto/tls" "strings" "time" @@ -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(