Files
Liam 6003c2436a
All checks were successful
Publish Docker Images / docker (push) Successful in 1m52s
metrics!!!!!!!!!!!
2023-11-16 17:52:44 +00:00

30 lines
612 B
TypeScript

import { InfluxDB } from "@influxdata/influxdb-client";
/**
* Creates an InfluxDB client
*
* @param token the influx token
* @param url the url of the influx instance
* @param org the org of the influx instance
* @param bucket the bucket of the influx instance
* @returns
*/
function createInfluxClient(
token: string,
url: string,
org: string,
bucket: string
) {
const client = new InfluxDB({
url: url,
token: token,
});
return {
influxWriteClient: client.getWriteApi(org, bucket, "ms"),
influxQueryClient: client.getQueryApi(org),
};
}
export { createInfluxClient };