Browse Source

🔨 Change conn exports

main
Haris Razis 4 years ago
parent
commit
c16d47666c
No known key found for this signature in database GPG Key ID: 86A4D290ED03FAB4
  1. 4
      server/connections/influx_conn.js
  2. 0
      server/connections/mongo_conn.js
  3. 14
      server/connections/redis_conn.js

4
server/connections/influx_conn.js

@ -8,7 +8,7 @@ const client = new InfluxDB({
token: influx_token, token: influx_token,
}); });
const writeApi = client.getWriteApi( const write = client.getWriteApi(
influx_org, influx_org,
influx_bucket influx_bucket
); );
@ -16,4 +16,4 @@ const writeApi = client.getWriteApi(
const queryApi = client.getQueryApi(influx_org); const queryApi = client.getQueryApi(influx_org);
console.log(chalk.greenBright.bold('Connected to influx!')) console.log(chalk.greenBright.bold('Connected to influx!'))
module.exports = {writeApi, queryApi} module.exports = {writeApi: write, queryApi}

0
server/connections/mongo_conn.js

14
server/connections/redis_conn.js

@ -1,14 +1,18 @@
const redis = require('redis'); const redis = require('redis');
const chalk = require('chalk'); const chalk = require('chalk');
const {redis_user, redis_password, redis_host, redis_port} = require('../config/keys') const {redis_host, redis_port} = require('../config/keys')
const client = redis.createClient(`redis://${redis_host}:${redis_port}`); const pub = redis.createClient(`redis://${redis_host}:${redis_port}`);
const sub = pub.duplicate();
client.on('error', function (error) { pub.on('error', (error) => {
console.error(error); console.error(error);
}); });
console.log(chalk.greenBright.bold('Connected to redis!')) pub.on('ready', () => {
pub.flush;
console.log(chalk.greenBright.bold('Connected to redis!'))
})
module.exports = {client} module.exports = {pub, sub}
Loading…
Cancel
Save