Add back VERSION info.

This commit is contained in:
2020-06-12 23:30:50 -05:00
parent 48853538f3
commit f5f117b890
5 changed files with 29 additions and 6 deletions
@@ -2,6 +2,7 @@
// Copyright 2020 DxOS.org
//
import fs from 'fs';
import moment from 'moment';
import pick from 'lodash.pick';
import os from 'os';
@@ -23,6 +24,15 @@ const size = (n, unit) => {
return num.format(Math.round(n / (10 ** power))) + (unit ? ` ${unit}` : '');
};
const getVersionInfo = () => {
// TODO(telackey): Get from config (or figure out a better way to do this).
const versionFile = '/opt/xbox/VERSION';
if (fs.existsSync(versionFile)) {
return fs.readFileSync(versionFile, { encoding: 'UTF8' }).replace(/^\s+|\s+$/g, '')
}
return undefined;
}
/**
* Get system inforamtion.
* https://www.npmjs.com/package/systeminformation
@@ -74,6 +84,12 @@ const getSystemInfo = async () => {
nodejs: {
version: process.version
},
dxos: {
xbox: {
version: getVersionInfo()
}
}
};
};