@skyra/influx-utilities
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

@skyra/influx-utilities

A tiny opinionated abstraction layer for InfluxDB for interacting with a single organization, based on Skyra's internal tools.

Usage

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.

Environment Variables

// 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();

setInfluxVariables

// 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();

Directly through Client.Options

import { Client } from '@skyra/influx-utilities';

const client = new Client({
	url: 'https://influxdb.skyra.pw',
	token: 'my-secret-token',
	org: 'Skyra-Project',
	writeBucket: 'analytics'
});

Package Sidebar

Install

npm i @skyra/influx-utilities

Weekly Downloads

150

Version

1.1.0

License

Apache-2.0

Unpacked Size

22.9 kB

Total Files

6

Last publish

Collaborators

  • favna
  • kyranet