diff --git a/agent.js b/agent.js index a14d212..6e29ddd 100644 --- a/agent.js +++ b/agent.js @@ -7,19 +7,20 @@ const agentOptions = { }; if (process.env.PINNED_FP) { - // console.log('Pinned fingerprint:', process.env.PINNED_FP); + console.log('Pinned fingerprint:', process.env.PINNED_FP); agentOptions.checkServerIdentity = (_host, cert) => { //TODO: host verification? e.g. tls.checkServerIdentity(host, cert); - // console.log('Checking:', cert.fingerprint256); + console.log('Checking:', cert.fingerprint256); if (process.env.PINNED_FP !== cert.fingerprint256) { return new Error('Certificate not pinned'); } }; } +import fs from 'fs'; if (process.env.CUSTOM_CA_PATH) { - // console.log('Private CA file path:', process.env.CUSTOM_CA_PATH); - agentOptions.ca = require('fs').readFileSync(process.env.CUSTOM_CA_PATH); + console.log('Private CA file path:', process.env.CUSTOM_CA_PATH); + agentOptions.ca = fs.readFileSync(process.env.CUSTOM_CA_PATH); } const agent = new https.Agent(agentOptions); diff --git a/redis.js b/redis.js index 484e059..e050582 100644 --- a/redis.js +++ b/redis.js @@ -1,5 +1,8 @@ 'use strict'; +import dotenv from 'dotenv'; +await dotenv.config({ path: '.env' }); + import Redis from 'ioredis';; export const client = new Redis({ diff --git a/server.js b/server.js index 8bc7924..6fb4597 100644 --- a/server.js +++ b/server.js @@ -5,7 +5,7 @@ process .on('unhandledRejection', console.error); import dotenv from 'dotenv'; -dotenv.config({ path: '.env' }); +await dotenv.config({ path: '.env' }); import express from 'express'; import next from 'next'; diff --git a/stats/main.js b/stats/main.js index 0ee62c4..1f201ef 100644 --- a/stats/main.js +++ b/stats/main.js @@ -29,7 +29,7 @@ async function main() { clusterUrls.forEach(cu => { //group to a certain amount in each array? ehh probs not haproxyStatsQueue.add({ hosts: [cu] }, { removeOnComplete: true }); - }) + }); } catch(e) { console.error(e); } diff --git a/stats/worker.js b/stats/worker.js index f67ad22..e749b39 100644 --- a/stats/worker.js +++ b/stats/worker.js @@ -97,6 +97,7 @@ async function getFormattedStats(host) { }; async function processHost(host) { + console.log(host) try { const hostname = new URL(host).hostname; const { frontendStats, serverStats } = await getFormattedStats(host); @@ -141,10 +142,10 @@ async function processHost(host) { }; async function handleJob(job, done) { + console.log('handleJob') const { hosts } = job.data; hosts.forEach(processHost); done(); } haproxyStatsQueue.process(handleJob); -