2023-02-09 20:34:53 +00:00
|
|
|
const log = require('../utils/log.utils'); // Log Helper
|
|
|
|
const db = require('../services/dbAccess.services')
|
|
|
|
const os = require('os')
|
2023-03-10 22:18:56 +00:00
|
|
|
const vers = require('../configs/version.configs')
|
2023-02-09 20:34:53 +00:00
|
|
|
|
|
|
|
async function hits(){
|
2023-03-13 20:10:45 +00:00
|
|
|
log.out("statsServices.hits: Statistics Requested")
|
2023-02-16 10:39:19 +00:00
|
|
|
var dat = db.query("meta", {target: "counters"});
|
2023-03-13 20:10:45 +00:00
|
|
|
var ver = db.query("meta", {target: "versions"});
|
|
|
|
log.out(`statsServices.hits: fetched server meta`)
|
2023-03-10 22:18:56 +00:00
|
|
|
let out = {};
|
|
|
|
out.host = os.hostname();
|
|
|
|
out.mode = process.env.NODE_ENV;
|
|
|
|
out.verBkend = vers.app;
|
|
|
|
out.dat = await dat;
|
2023-03-13 20:10:45 +00:00
|
|
|
out.ver = await ver;
|
|
|
|
log.out(`statsServices.hits: Sending Data: ${JSON.stringify(out)}`)
|
2023-02-09 20:34:53 +00:00
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
hits
|
|
|
|
}
|