InfoBroker: fix make_table_meta
This commit is contained in:
parent
67a235ad42
commit
5d0e480f1c
2 changed files with 5 additions and 3 deletions
|
@ -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.
|
// 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.mode = mode;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.info = new InfoBroker();
|
this.info = new InfoBroker(this);
|
||||||
|
|
||||||
this.pkg = null;
|
this.pkg = null;
|
||||||
this.version = null;
|
this.version = null;
|
||||||
|
|
|
@ -12,7 +12,9 @@ const __dirname = import.meta.url.slice(7, import.meta.url.lastIndexOf("/"));
|
||||||
|
|
||||||
|
|
||||||
class InfoBroker {
|
class InfoBroker {
|
||||||
constructor() {
|
constructor(sysquery) {
|
||||||
|
this.sysquery = sysquery;
|
||||||
|
|
||||||
this.allowed_tables = {
|
this.allowed_tables = {
|
||||||
// name → sysinfo name
|
// name → sysinfo name
|
||||||
cpu: "cpu",
|
cpu: "cpu",
|
||||||
|
@ -32,7 +34,7 @@ class InfoBroker {
|
||||||
|
|
||||||
async make_table_meta() {
|
async make_table_meta() {
|
||||||
return {
|
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,
|
versions_env: process.versions,
|
||||||
pid: process.pid,
|
pid: process.pid,
|
||||||
uptime: process.uptime(),
|
uptime: process.uptime(),
|
||||||
|
|
Loading…
Reference in a new issue