Skip to content

Commit

Permalink
changes in port
Browse files Browse the repository at this point in the history
  • Loading branch information
Nithunikzz committed Oct 27, 2023
1 parent 72f492e commit ebfbbb5
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions client/pkg/clickhouse/db_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,38 +50,38 @@ type DBInterface interface {

func NewDBClient(conf *config.Config) (DBInterface, error) {
ctx := context.Background()
// var connOptions clickhouse.Options

// if conf.ClickHouseUsername != "" && conf.ClickHousePassword != "" {
connOptions := clickhouse.Options{
Addr: []string{fmt.Sprintf("%s:%d", conf.DBAddress, conf.DbPort)},
Debug: true,
Auth: clickhouse.Auth{
Username: "admin",
Password: "admin",
},
Debugf: func(format string, v ...interface{}) {
fmt.Printf(format, v...)
},
Settings: clickhouse.Settings{
"allow_experimental_object_type": 1,
},
}
fmt.Printf("Connecting to ClickHouse using username and password")
// } else {
// connOptions = clickhouse.Options{
// Addr: []string{fmt.Sprintf("%s:%d", conf.DBAddress, conf.DbPort)},
// Debug: true,
// Debugf: func(format string, v ...interface{}) {
// fmt.Printf(format, v...)
// },
// Settings: clickhouse.Settings{
// "allow_experimental_object_type": 1,
// },
// }
// fmt.Printf("Connecting to ClickHouse without usename and password")
var connOptions clickhouse.Options

if conf.ClickHouseUsername != "" && conf.ClickHousePassword != "" {
connOptions = clickhouse.Options{
Addr: []string{fmt.Sprintf("%s:%d", conf.DBAddress, conf.DbPort)},
Debug: true,
Auth: clickhouse.Auth{
Username: conf.ClickHouseUsername,
Password: conf.ClickHousePassword,
},
Debugf: func(format string, v ...interface{}) {
fmt.Printf(format, v...)
},
Settings: clickhouse.Settings{
"allow_experimental_object_type": 1,
},
}
fmt.Printf("Connecting to ClickHouse using username and password")
} else {
connOptions = clickhouse.Options{
Addr: []string{fmt.Sprintf("%s:%d", conf.DBAddress, conf.DbPort)},
Debug: true,
Debugf: func(format string, v ...interface{}) {
fmt.Printf(format, v...)
},
Settings: clickhouse.Settings{
"allow_experimental_object_type": 1,
},
}
fmt.Printf("Connecting to ClickHouse without usename and password")

// }
}

splconn, err := clickhouse.Open(&connOptions)
if err != nil {
Expand Down

0 comments on commit ebfbbb5

Please sign in to comment.