From 2a662e0bd1f7c594d031bbb8e5906f69d12e880f Mon Sep 17 00:00:00 2001 From: Ruakij Date: Fri, 26 Nov 2021 17:32:31 +0100 Subject: [PATCH] Changed constructor to take influxDb --- src/streamHandler/InfluxPointWriter.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/streamHandler/InfluxPointWriter.js b/src/streamHandler/InfluxPointWriter.js index 9a57136..fbf64cc 100644 --- a/src/streamHandler/InfluxPointWriter.js +++ b/src/streamHandler/InfluxPointWriter.js @@ -8,14 +8,12 @@ const {InfluxDB, Point, HttpError} = require('@influxdata/influxdb-client') class InfluxPointWriter extends Writable{ /** * - * @param {string} url Influx-Url - * @param {string} token Auth-token + * @param {InfluxDB} influxDb InfluxDb * @param {string} org Organization to use * @param {string} bucket Bucket to use - * @param {string} precision Precision to use + * @param {Partial} options Options for WriteApi */ - constructor(url, token, org, bucket, precision = 'us'){ - this._api = new InfluxDB({url, token}).getWriteApi(org, bucket, precision); + this._api = influxDb.getWriteApi(org, bucket, 'us', options); } _write(point, encoding, next){