Rename clickhouse user to username

This commit is contained in:
Daniel Nelson 2020-03-04 14:44:37 -08:00
parent bffd57aa58
commit 6edd57ea87
No known key found for this signature in database
GPG Key ID: CAAD59C9444F6155
2 changed files with 5 additions and 5 deletions

View File

@ -8,7 +8,7 @@ This plugin gathers the statistic data from [ClickHouse](https://github.com/Clic
[[inputs.clickhouse]] [[inputs.clickhouse]]
## Username for authorization on ClickHouse server ## Username for authorization on ClickHouse server
## example: user = "default" ## example: user = "default"
user = "default" username = "default"
## Password for authorization on ClickHouse server ## Password for authorization on ClickHouse server
## example: password = "super_secret" ## example: password = "super_secret"

View File

@ -24,7 +24,7 @@ var defaultTimeout = 5 * time.Second
var sampleConfig = ` var sampleConfig = `
## Username for authorization on ClickHouse server ## Username for authorization on ClickHouse server
## example: user = "default"" ## example: user = "default""
user = "default" username = "default"
## Password for authorization on ClickHouse server ## Password for authorization on ClickHouse server
## example: password = "super_secret" ## example: password = "super_secret"
@ -108,7 +108,7 @@ func init() {
// ClickHouse Telegraf Input Plugin // ClickHouse Telegraf Input Plugin
type ClickHouse struct { type ClickHouse struct {
User string `toml:"user"` Username string `toml:"username"`
Password string `toml:"password"` Password string `toml:"password"`
Servers []string `toml:"servers"` Servers []string `toml:"servers"`
AutoDiscovery bool `toml:"auto_discovery"` AutoDiscovery bool `toml:"auto_discovery"`
@ -320,8 +320,8 @@ func (ch *ClickHouse) execQuery(url *url.URL, query string, i interface{}) error
q.Set("query", query+" FORMAT JSON") q.Set("query", query+" FORMAT JSON")
url.RawQuery = q.Encode() url.RawQuery = q.Encode()
req, _ := http.NewRequest("GET", url.String(), nil) req, _ := http.NewRequest("GET", url.String(), nil)
if ch.User != "" { if ch.Username != "" {
req.Header.Add("X-ClickHouse-User", ch.User) req.Header.Add("X-ClickHouse-User", ch.Username)
} }
if ch.Password != "" { if ch.Password != "" {
req.Header.Add("X-ClickHouse-Key", ch.Password) req.Header.Add("X-ClickHouse-Key", ch.Password)