Skip to content

Commit 6b4ddc3

Browse files
committed
Allow plaintext clickhouse connections
Resolves #42 commit_hash:dcb6ac95e92aa40e97e755e59c1d1f7b82ba2270
1 parent 283248e commit 6b4ddc3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

perforator/pkg/clickhouse/clickhouse.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@ type Config struct {
1717
Database string `yaml:"db"`
1818
User string `yaml:"user"`
1919
PasswordEnvironmentVariable string `yaml:"password_env"`
20-
InsecureSkipVerify bool `yaml:"insecure,omitempty"`
21-
CACertPath string `yaml:"ca_cert_path,omitempty"`
20+
// TODO: all the followng fields should be replaced with
21+
// TLSConfig (https://github.com/yandex/perforator/blob/283248e4d7c0bd8c66c9ff28178fb635be5581ab/perforator/pkg/storage/client/client.go#L114)
22+
Plaintext bool `yaml:"plaintext,omitempty"`
23+
InsecureSkipVerify bool `yaml:"insecure,omitempty"`
24+
CACertPath string `yaml:"ca_cert_path,omitempty"`
2225
}
2326

2427
func Connect(ctx context.Context, conf *Config) (driver.Conn, error) {
@@ -41,6 +44,9 @@ func Connect(ctx context.Context, conf *Config) (driver.Conn, error) {
4144

4245
tlsConf.RootCAs = certPool
4346
}
47+
if conf.Plaintext {
48+
tlsConf = nil
49+
}
4450

4551
conn, err := clickhouse.Open(&clickhouse.Options{
4652
Addr: conf.Replicas,

0 commit comments

Comments
 (0)