A tiny opinionated abstraction layer for InfluxDB for interacting with a single organization, based on Skyra's internal tools.
You can provide the configuration for the Influx client in several ways.
-
INFLUX_URL
:ConnectionOptions.url
, the base URL to be used. -
INFLUX_TOKEN
:ConnectionOptions.token
, the authentication token. -
INFLUX_ORG
:ConnectionOptions.org
, the organization to use for the query and write APIs. -
INFLUX_BUCKET
:ConnectionOptions.writeBucket
, the bucket to write to in the write API.
// index.ts
process.env.INFLUX_URL = 'https://influxdb.skyra.pw';
process.env.INFLUX_TOKEN = 'my-secret-token';
process.env.INFLUX_ORG = 'Skyra-Project';
process.env.INFLUX_BUCKET = 'analytics';
import { Client } from '@skyra/influx-utilities';
const client = new Client();
// index.ts
import { Client, setInfluxVariables } from '@skyra/influx-utilities';
setInfluxVariables({
influxUrl: 'https://influxdb.skyra.pw',
influxToken: 'my-secret-token',
influxOrg: 'Skyra-Project',
influxBucket: 'analytics'
});
const client = new Client();
import { Client } from '@skyra/influx-utilities';
const client = new Client({
url: 'https://influxdb.skyra.pw',
token: 'my-secret-token',
org: 'Skyra-Project',
writeBucket: 'analytics'
});