Added username, site and password for influxdb datasources

This commit is contained in:
Torkel Ödegaard
2014-12-19 08:19:12 +01:00
parent 525b367a6f
commit e5811e29b1
6 changed files with 25 additions and 2 deletions
+10
View File
@@ -28,14 +28,24 @@ func renderConfig(data *configJsTmplModel) string {
for i, ds := range data.DataSources {
url := ds.Url
if ds.Access == m.DS_ACCESS_PROXY {
url = "/api/datasources/proxy/" + strconv.FormatInt(ds.Id, 10)
}
var dsMap = map[string]interface{}{
"type": ds.Type,
"url": url,
}
if ds.Type == m.DS_INFLUXDB {
if ds.Access == m.DS_ACCESS_DIRECT {
dsMap["username"] = ds.User
dsMap["password"] = ds.Password
dsMap["url"] = url + "/db/" + ds.Database
}
}
// temp hack, first is always default
// TODO: implement default ds account setting
if i == 0 {