Haris Razis
4 years ago
2 changed files with 7 additions and 12 deletions
@ -1,20 +1,16 @@ |
|||||
const {InfluxDB} = require('@influxdata/influxdb-client') |
const {InfluxDB} = require('@influxdata/influxdb-client') |
||||
const chalk = require('chalk') |
const chalk = require('chalk') |
||||
|
|
||||
const {influx_uri, influx_token, influx_org, influx_bucket} = require('../config/keys') |
const {influx_url, influx_org, influx_bucket} = require('../config/keys') |
||||
|
|
||||
const client = new InfluxDB({ |
const client = new InfluxDB({ |
||||
url: influx_uri, |
url: influx_url |
||||
token: influx_token, |
|
||||
}); |
}); |
||||
|
|
||||
const write = client.getWriteApi( |
const writeApi = client.getWriteApi(influx_org, influx_bucket, 's'); |
||||
influx_org, |
|
||||
influx_bucket |
|
||||
); |
|
||||
|
|
||||
const queryApi = client.getQueryApi(influx_org); |
const queryApi = client.getQueryApi(influx_org); |
||||
|
|
||||
console.log(chalk.greenBright.bold('Connected to influx!')) |
console.log(chalk.greenBright.bold('Connected to influx!')) |
||||
|
|
||||
module.exports = {write, queryApi} |
module.exports = {writeApi, queryApi} |
Loading…
Reference in new issue