Skip to content

Commit

Permalink
[TASK] allow self-signed certification in influxdb
Browse files Browse the repository at this point in the history
  • Loading branch information
genofire committed May 5, 2018
1 parent 10f58a7 commit c304c8b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
13 changes: 10 additions & 3 deletions database/influxdb/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ func (c Config) Username() string {
func (c Config) Password() string {
return c["password"].(string)
}
func (c Config) InsecureSkipVerify() bool {
if d, ok := c["insecure_skip_verify"]; ok {
return d.(bool)
}
return false
}
func (c Config) Tags() map[string]interface{} {
if c["tags"] != nil {
return c["tags"].(map[string]interface{})
Expand All @@ -61,9 +67,10 @@ func Connect(configuration map[string]interface{}) (database.Connection, error)

// Make client
c, err := client.NewHTTPClient(client.HTTPConfig{
Addr: config.Address(),
Username: config.Username(),
Password: config.Password(),
Addr: config.Address(),
Username: config.Username(),
Password: config.Password(),
InsecureSkipVerify: config.InsecureSkipVerify(),
})

if err != nil {
Expand Down
7 changes: 4 additions & 3 deletions database/influxdb/database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ func TestConnect(t *testing.T) {
assert := assert.New(t)

conn, err := Connect(map[string]interface{}{
"address": "",
"username": "",
"password": "",
"address": "",
"username": "",
"password": "",
"insecure_skip_verify": true,
})
assert.Nil(conn)
assert.Error(err)
Expand Down
10 changes: 10 additions & 0 deletions docs/docs_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ address = "http://localhost:8086"
database = "ffhb"
username = ""
password = ""
insecure_skip_verify = false
[database.connection.influxdb.tags]
tagname1 = "tagvalue 1"
system = "productive"
Expand Down Expand Up @@ -625,6 +626,15 @@ password = ""
```
{% endmethod %}

### insecure_skip_verify
{% method %}
Skip insecure verify for self-signed certificates.
{% sample lang="toml" %}
```toml
insecure_skip_verify = true
```
{% endmethod %}


### [database.connection.influxdb.tags]
{% method %}
Expand Down

0 comments on commit c304c8b

Please sign in to comment.