Changed constructor to take influxDb

f_influx-checks
Ruakij 3 years ago
parent d7a9530b68
commit 2a662e0bd1

@ -8,14 +8,12 @@ const {InfluxDB, Point, HttpError} = require('@influxdata/influxdb-client')
class InfluxPointWriter extends Writable{ class InfluxPointWriter extends Writable{
/** /**
* *
* @param {string} url Influx-Url * @param {InfluxDB} influxDb InfluxDb
* @param {string} token Auth-token
* @param {string} org Organization to use * @param {string} org Organization to use
* @param {string} bucket Bucket to use * @param {string} bucket Bucket to use
* @param {string} precision Precision to use * @param {Partial<WriteOptions>} options Options for WriteApi
*/ */
constructor(url, token, org, bucket, precision = 'us'){ this._api = influxDb.getWriteApi(org, bucket, 'us', options);
this._api = new InfluxDB({url, token}).getWriteApi(org, bucket, precision);
} }
_write(point, encoding, next){ _write(point, encoding, next){

Loading…
Cancel
Save