diff --git a/src/lib/SystemQuery.mjs b/src/lib/SystemQuery.mjs index 5ec0d80..a0e272c 100644 --- a/src/lib/SystemQuery.mjs +++ b/src/lib/SystemQuery.mjs @@ -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; diff --git a/src/lib/core/InfoBroker.mjs b/src/lib/core/InfoBroker.mjs index 1f73519..27a0030 100644 --- a/src/lib/core/InfoBroker.mjs +++ b/src/lib/core/InfoBroker.mjs @@ -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(),