-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ClickHouse: Add Support for Secure Connection #436
Conversation
pkg/clickhouse/config.go
Outdated
@@ -28,10 +29,18 @@ func (c *Config) ToClickHouseOptions() *click_house.Options { | |||
} | |||
|
|||
func (c *Config) GetIngestrURI() string { | |||
//nolint:nosprintfhostport | |||
uri := fmt.Sprintf("clickhouse://%s:%s@%s:%d", c.Username, c.Password, c.Host, c.Port) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend using url
package to build the URI. It will automatically escape URI characters, making this a lot more robust.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -13,6 +13,7 @@ type Config struct { | |||
Port int | |||
Database string | |||
HTTPPort int | |||
Secure *int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we avoid using pointers?
Instead treat 0
as the null value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, we cannot treat 0 as a null value because 0 indicates a non-secure connection, 1 means a secure connection, and "not set" is represented as nil. For that I have to use pointer
Following changes are made in this PR: