Comparing version 3.3.0 to 3.4.0
@@ -12,2 +12,3 @@ | ||
port : 8086, | ||
protocol : 'http', | ||
depreciatedLogging : (process.env.NODE_ENV === undefined || 'development') ? console.log : false, | ||
@@ -32,3 +33,3 @@ failoverTimeout : 60000, | ||
{ | ||
this.request.addHost(this.options.host,this.options.port); | ||
this.request.addHost(this.options.host, this.options.port, this.options.protocol); | ||
} | ||
@@ -39,3 +40,5 @@ if (_.isArray(this.options.hosts) && 0 < this.options.hosts.length) | ||
_.each(this.options.hosts,function(host){ | ||
self.request.addHost(host.host, host.port || self.options.port); | ||
var port = host.port || self.options.port; | ||
var protocol = host.protocol || self.options.protocol; | ||
self.request.addHost(host.host, port, protocol); | ||
}); | ||
@@ -42,0 +45,0 @@ } |
@@ -43,6 +43,7 @@ | ||
InfluxRequest.prototype.addHost = function (hostname, port) { | ||
InfluxRequest.prototype.addHost = function (hostname, port, protocol) { | ||
this.hostsAvailable.push({ | ||
name: hostname, | ||
port: port, | ||
protocol: protocol, | ||
available: true, | ||
@@ -92,3 +93,3 @@ timeout: 0 | ||
return url.format({ | ||
protocol: 'http:', | ||
protocol: host.protocol, | ||
hostname: host.name, | ||
@@ -95,0 +96,0 @@ port: host.port |
{ | ||
"name": "influx", | ||
"version": "3.3.0", | ||
"version": "3.4.0", | ||
"description": "InfluxDB Client", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -10,3 +10,2 @@ # node-influx | ||
[![Dependency Status](https://david-dm.org/bencevans/node-influx.png)](https://david-dm.org/bencevans/node-influx) | ||
[![gittip](https://img.shields.io/gittip/bencevans.svg)](https://www.gittip.com/bencevans/) | ||
@@ -25,2 +24,4 @@ | ||
```js | ||
var influx = require('influx') | ||
var client = influx({ | ||
@@ -32,3 +33,4 @@ | ||
host : 'localhost', | ||
port : 8060 //optional. default 8086 | ||
port : 8060, //optional. default 8086 | ||
protocol : 'http' //optional. default 'http' | ||
} | ||
@@ -39,6 +41,7 @@ ], | ||
port : 8086, // optional, default 8086 | ||
protocol : 'http', // optional, default 'http' | ||
username : 'dbuser', | ||
password : 'f4ncyp4ass', | ||
database : 'my_database' | ||
}); | ||
}) | ||
@@ -64,2 +67,3 @@ ``` | ||
| port [optional] | influxdb port, default: 8086 | | ||
| protocol [optional] | protocol, default: http | | ||
| hosts [optional] | Array of hosts for cluster configuration, e.g. [ {host: 'localhost', port : 8086},...] Port is optional | | ||
@@ -66,0 +70,0 @@ | depreciatedLogging [optional] | logging function for depreciated warnings, defaults to console.log | |
36
test.js
@@ -433,2 +433,36 @@ var influx = require('./'); | ||
}); | ||
}); | ||
}); | ||
describe('HTTPS connection', function() { | ||
var client; | ||
var dbName = 'https_db'; | ||
describe('connect and create test DB', function () { | ||
before(function() { | ||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; // allow self-signed cert | ||
client = influx({ | ||
host: 'localhost', | ||
port: 8084, | ||
protocol: 'https', | ||
username: 'root', | ||
password: 'root', | ||
timePrecision: 'ms' | ||
}); | ||
}); | ||
it('should create a new database without error', function (done) { | ||
client.createDatabase(dbName, done); | ||
}); | ||
it('should throw an error if db already exists', function (done) { | ||
client.createDatabase(dbName, function (err) { | ||
assert(err instanceof Error); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
42218
946
295
2