Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Nithunikzz committed Oct 30, 2023
1 parent db2f207 commit 09d6441
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cmd/cli/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ func OpenClickHouseConn() (*sql.DB, *Config, error) {
if err != nil {
return nil, nil, err
}
var conns clickhouse.Options
var options clickhouse.Options

if cfg.ClickHouseUsername != "" && cfg.ClickHousePassword != "" {
fmt.Println("Using provided username and password")
conns = clickhouse.Options{
options = clickhouse.Options{
Addr: []string{fmt.Sprintf("%s:%d", cfg.DBAddress, cfg.DbPort)},
Debug: true,
Auth: clickhouse.Auth{
Expand All @@ -36,12 +36,12 @@ func OpenClickHouseConn() (*sql.DB, *Config, error) {
}
} else {
fmt.Println("Using connection without username and password")
conns = clickhouse.Options{
options = clickhouse.Options{
Addr: []string{fmt.Sprintf("%s:%d", cfg.DBAddress, cfg.DbPort)},
}
}

conn := clickhouse.OpenDB(&conns)
conn := clickhouse.OpenDB(&options)
if err := conn.Ping(); err != nil {
if exception, ok := err.(*clickhouse.Exception); ok {
return nil, nil, fmt.Errorf("[%d] %s %s", exception.Code, exception.Message, exception.StackTrace)
Expand Down

0 comments on commit 09d6441

Please sign in to comment.