Haris Razis
4 years ago
3 changed files with 33 additions and 19 deletions
@ -1,19 +0,0 @@ |
|||||
const {InfluxDB} = require('@influxdata/influxdb-client') |
|
||||
const chalk = require('chalk') |
|
||||
|
|
||||
const {url, token, org, bucket} = require('../config/dev') |
|
||||
|
|
||||
const client = new InfluxDB({ |
|
||||
url: url, |
|
||||
token: token, |
|
||||
}); |
|
||||
|
|
||||
const writeApi = client.getWriteApi( |
|
||||
org, |
|
||||
bucket |
|
||||
); |
|
||||
|
|
||||
const queryApi = client.getQueryApi(org); |
|
||||
console.log(chalk.yellow('Initialized Database connection...')); |
|
||||
|
|
||||
module.exports = {writeApi, queryApi} |
|
@ -0,0 +1,19 @@ |
|||||
|
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} |
@ -0,0 +1,14 @@ |
|||||
|
const redis = require('redis'); |
||||
|
const chalk = require('chalk'); |
||||
|
|
||||
|
const {redis_user, redis_password, redis_host, redis_port} = require('../config/keys') |
||||
|
|
||||
|
const client = redis.createClient(`redis://${redis_host}:${redis_port}`); |
||||
|
|
||||
|
client.on('error', function (error) { |
||||
|
console.error(error); |
||||
|
}); |
||||
|
|
||||
|
console.log(chalk.greenBright.bold('Connected to redis!')) |
||||
|
|
||||
|
module.exports = {client} |
Loading…
Reference in new issue