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-30 21:15:21 +01:00
|
|
|
log.out("statsServices.hits: Statistics Requested", "info")
|
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"});
|
2023-03-30 21:15:21 +01:00
|
|
|
log.out(`statsServices.hits: fetched server meta`, "info")
|
2023-03-10 22:18:56 +00:00
|
|
|
let out = {};
|
|
|
|
out.host = os.hostname();
|
|
|
|
out.mode = process.env.NODE_ENV;
|
|
|
|
out.verBkend = vers.app;
|
2023-03-30 21:18:07 +01:00
|
|
|
out.verApi = vers.api;
|
2023-03-10 22:18:56 +00:00
|
|
|
out.dat = await dat;
|
2023-03-13 20:10:45 +00:00
|
|
|
out.ver = await ver;
|
2023-03-30 21:15:21 +01:00
|
|
|
log.out(`statsServices.hits: Sending Data: ${JSON.stringify(out)}`, "info")
|
2023-02-09 20:34:53 +00:00
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
hits
|
|
|
|
}
|