From 4558486cbd561dc7a5db8c440eb2718a6694b9a4 Mon Sep 17 00:00:00 2001 From: Daniel Shir Date: Tue, 9 Sep 2014 15:23:40 +0300 Subject: [PATCH] Added basic authorization for influxdb if needed --- src/app/services/influxdb/influxdbDatasource.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/app/services/influxdb/influxdbDatasource.js b/src/app/services/influxdb/influxdbDatasource.js index 846b5ed80e1..d9a7d8b378c 100644 --- a/src/app/services/influxdb/influxdbDatasource.js +++ b/src/app/services/influxdb/influxdbDatasource.js @@ -19,6 +19,7 @@ function (angular, _, kbn, InfluxSeries, InfluxQueryBuilder) { this.username = datasource.username; this.password = datasource.password; this.name = datasource.name; + this.basicAuth = datasource.basicAuth; this.saveTemp = _.isUndefined(datasource.save_temp) ? true : datasource.save_temp; this.saveTempTTL = _.isUndefined(datasource.save_temp_ttl) ? '30d' : datasource.save_temp_ttl; @@ -170,6 +171,11 @@ function (angular, _, kbn, InfluxSeries, InfluxQueryBuilder) { inspect: { type: 'influxdb' }, }; + options.headers = options.headers || {}; + if (_this.basicAuth) { + options.headers.Authorization = 'Basic ' + _this.basicAuth; + } + return $http(options).success(function (data) { deferred.resolve(data); });