Skip to content
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

Merged
merged 10 commits into from
Feb 3, 2025

Conversation

sanjushahgupta
Copy link
Collaborator

@sanjushahgupta sanjushahgupta commented Feb 2, 2025

Following changes are made in this PR:

  • Improved connection handling by allowing users to specify secure or non-secure connections using the secure parameter
  • By default, the secure parameter is set to 1, i.e secure connection.
Screenshot 2025-02-03 at 11 15 14 Screenshot 2025-02-03 at 11 15 38

@sanjushahgupta sanjushahgupta marked this pull request as ready for review February 3, 2025 11:43
@sanjushahgupta sanjushahgupta changed the title [WIP] ClickHouse: Add Support for Secure Connection Parameter ClickHouse: Add Support for Secure Connection Feb 3, 2025
@@ -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)
Copy link
Contributor

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.

Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Collaborator Author

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

@sanjushahgupta sanjushahgupta merged commit caf45cf into main Feb 3, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants