2023-02-09 20:34:53 +00:00
|
|
|
const log = require('../utils/log.utils'); // Log Helper
|
2023-05-06 21:54:49 +01:00
|
|
|
const db = require('../services/dbAccess.services');
|
|
|
|
const os = require('os');
|
|
|
|
const vers = require('../configs/version.configs');
|
2023-02-09 20:34:53 +00:00
|
|
|
|
|
|
|
async function hits(){
|
2023-05-06 21:54:49 +01:00
|
|
|
log.out('statsServices.hits: Statistics Requested', 'info');
|
|
|
|
var dat = db.query('meta', {target: 'counters'});
|
|
|
|
var ver = db.query('meta', {target: 'versions'});
|
|
|
|
log.out('statsServices.hits: fetched server meta', 'info');
|
|
|
|
let out = {};
|
|
|
|
out.host = os.hostname();
|
|
|
|
// eslint-disable-next-line no-undef
|
|
|
|
out.mode = process.env.NODE_ENV;
|
|
|
|
out.verBkend = vers.app;
|
|
|
|
out.verApi = vers.api;
|
|
|
|
out.dat = await dat;
|
|
|
|
out.ver = await ver;
|
|
|
|
log.out(`statsServices.hits: Sending Data: ${JSON.stringify(out)}`, 'info');
|
|
|
|
return out;
|
2023-02-09 20:34:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
2023-05-06 21:54:49 +01:00
|
|
|
hits
|
|
|
|
};
|