Merge branch 'influxdb-selfsign' into 'master'

[TASK] allow self-signed certification in influxdb

See merge request FreifunkBremen/yanic!135
This commit is contained in:
Martin/Geno 2018-07-12 16:52:30 +02:00
commit cf8aeeeb78
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 {
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{})
@ -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 {

View File

@ -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)

View File

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