You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
482 B
19 lines
482 B
4 years ago
|
const {InfluxDB} = require('@influxdata/influxdb-client')
|
||
|
const chalk = require('chalk')
|
||
|
|
||
|
const {influx_url, influx_token, influx_org, influx_bucket} = require('../config/keys')
|
||
|
|
||
|
const client = new InfluxDB({
|
||
|
url: influx_url,
|
||
|
token: influx_token,
|
||
|
});
|
||
|
|
||
|
const writeApi = client.getWriteApi(
|
||
|
influx_org,
|
||
|
influx_bucket
|
||
|
);
|
||
|
|
||
|
const queryApi = client.getQueryApi(influx_org);
|
||
|
console.log(chalk.greenBright.bold('Connected to influx!'))
|
||
|
|
||
|
module.exports = {writeApi, queryApi}
|