Added username, site and password for influxdb datasources
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -26,6 +26,7 @@ func GetDataSources(c *middleware.Context) {
|
||||
Type: ds.Type,
|
||||
Access: ds.Access,
|
||||
Password: ds.Password,
|
||||
Database: ds.Database,
|
||||
User: ds.User,
|
||||
BasicAuth: ds.BasicAuth,
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ type DataSource struct {
|
||||
Url string `json:"url"`
|
||||
Password string `json:"password"`
|
||||
User string `json:"user"`
|
||||
Database string `json:"database"`
|
||||
BasicAuth bool `json:"basicAuth"`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user