Skip to content

Commit

Permalink
Rename clickhouse user to username
Browse files Browse the repository at this point in the history
  • Loading branch information
danielnelson committed Mar 4, 2020
1 parent bffd57a commit 6edd57e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion plugins/inputs/clickhouse/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This plugin gathers the statistic data from [ClickHouse](https://github.com/Clic
[[inputs.clickhouse]]
## Username for authorization on ClickHouse server
## example: user = "default"
user = "default"
username = "default"

## Password for authorization on ClickHouse server
## example: password = "super_secret"
Expand Down
8 changes: 4 additions & 4 deletions plugins/inputs/clickhouse/clickhouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var defaultTimeout = 5 * time.Second
var sampleConfig = `
## Username for authorization on ClickHouse server
## example: user = "default""
user = "default"
username = "default"
## Password for authorization on ClickHouse server
## example: password = "super_secret"
Expand Down Expand Up @@ -108,7 +108,7 @@ func init() {

// ClickHouse Telegraf Input Plugin
type ClickHouse struct {
User string `toml:"user"`
Username string `toml:"username"`
Password string `toml:"password"`
Servers []string `toml:"servers"`
AutoDiscovery bool `toml:"auto_discovery"`
Expand Down Expand Up @@ -320,8 +320,8 @@ func (ch *ClickHouse) execQuery(url *url.URL, query string, i interface{}) error
q.Set("query", query+" FORMAT JSON")
url.RawQuery = q.Encode()
req, _ := http.NewRequest("GET", url.String(), nil)
if ch.User != "" {
req.Header.Add("X-ClickHouse-User", ch.User)
if ch.Username != "" {
req.Header.Add("X-ClickHouse-User", ch.Username)
}
if ch.Password != "" {
req.Header.Add("X-ClickHouse-Key", ch.Password)
Expand Down

0 comments on commit 6edd57e

Please sign in to comment.