[TASK] allow self-signed certification in influxdb

This commit is contained in:
Martin/Geno 2018-05-05 23:46:12 +02:00
parent 71c3e5ffe4
commit 9c886d497e
No known key found for this signature in database
GPG Key ID: 9D7D3C6BFF600C6A
3 changed files with 24 additions and 6 deletions

View File

@ -45,6 +45,12 @@ func (c Config) Username() string {
func (c Config) Password() string { func (c Config) Password() string {
return c["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{} { func (c Config) Tags() map[string]interface{} {
if c["tags"] != nil { if c["tags"] != nil {
return c["tags"].(map[string]interface{}) return c["tags"].(map[string]interface{})
@ -64,6 +70,7 @@ func Connect(configuration map[string]interface{}) (database.Connection, error)
Addr: config.Address(), Addr: config.Address(),
Username: config.Username(), Username: config.Username(),
Password: config.Password(), Password: config.Password(),
InsecureSkipVerify: config.InsecureSkipVerify(),
}) })
if err != nil { if err != nil {

View File

@ -19,6 +19,7 @@ func TestConnect(t *testing.T) {
"address": "", "address": "",
"username": "", "username": "",
"password": "", "password": "",
"insecure_skip_verify": true,
}) })
assert.Nil(conn) assert.Nil(conn)
assert.Error(err) assert.Error(err)

View File

@ -569,6 +569,7 @@ address = "http://localhost:8086"
database = "ffhb" database = "ffhb"
username = "" username = ""
password = "" password = ""
insecure_skip_verify = false
[database.connection.influxdb.tags] [database.connection.influxdb.tags]
tagname1 = "tagvalue 1" tagname1 = "tagvalue 1"
system = "productive" system = "productive"
@ -616,6 +617,15 @@ password = ""
``` ```
{% endmethod %} {% 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] ### [database.connection.influxdb.tags]
{% method %} {% method %}