Files
akvorado/common/clickhousedb/config.go
Vincent Bernat 8be1bca4fd license: AGPL-3.0-only
```
git ls-files \*.js \*.go \
  | xargs sed -i '1i // SPDX-FileCopyrightText: 2022 Free Mobile\n// SPDX-License-Identifier: AGPL-3.0-only\n'
git ls-files \*.vue \
  | xargs sed -i '1i <!-- SPDX-FileCopyrightText: 2022 Free Mobile -->\n<!-- SPDX-License-Identifier: AGPL-3.0-only -->\n'
```
2022-06-29 11:42:28 +02:00

36 lines
1.0 KiB
Go

// SPDX-FileCopyrightText: 2022 Free Mobile
// SPDX-License-Identifier: AGPL-3.0-only
package clickhousedb
import (
"time"
)
// Configuration defines how we connect to a Clickhouse database
type Configuration struct {
// Servers define the list of clickhouse servers to connect to (with ports)
Servers []string
// Database defines the database to use
Database string
// Username defines the username to use for authentication
Username string
// Password defines the password to use for authentication
Password string
// MaxOpenConns tells how many parallel connections to ClickHouse we want
MaxOpenConns int
// DialTimeout tells how much time to wait when connecting to ClickHouse
DialTimeout time.Duration
}
// DefaultConfiguration represents the default configuration for connecting to Clickhouse
func DefaultConfiguration() Configuration {
return Configuration{
Servers: []string{"127.0.0.1:9000"},
Database: "default",
Username: "default",
MaxOpenConns: 10,
DialTimeout: 5 * time.Second,
}
}