InfoBroker: fix make_table_meta

This commit is contained in:
Starbeamrainbowlabs 2022-02-26 21:57:36 +00:00
parent 67a235ad42
commit 5d0e480f1c
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
2 changed files with 5 additions and 3 deletions

View file

@ -44,7 +44,7 @@ class SystemQuery extends EventEmitter {
// TODO: Is this the best way of doing this? Maybe we should have a separate class for this? I'm not sure.
this.mode = mode;
this.config = config;
this.info = new InfoBroker();
this.info = new InfoBroker(this);
this.pkg = null;
this.version = null;

View file

@ -12,7 +12,9 @@ const __dirname = import.meta.url.slice(7, import.meta.url.lastIndexOf("/"));
class InfoBroker {
constructor() {
constructor(sysquery) {
this.sysquery = sysquery;
this.allowed_tables = {
// name → sysinfo name
cpu: "cpu",
@ -32,7 +34,7 @@ class InfoBroker {
async make_table_meta() {
return {
version: JSON.parse(fs.promises.readFile(path.resolve(__dirname, "../../../package.json"), "utf-8")).version,
version: `${this.sysquery.version}-${this.sysquery.commit.substring(0, 7)}`,
versions_env: process.versions,
pid: process.pid,
uptime: process.uptime(),