diff --git a/index.js b/index.js index 55f6f64..6b8044e 100644 --- a/index.js +++ b/index.js @@ -10,6 +10,7 @@ const download = require("./units/download.js"); const service = require("./units/service.js"); const setup = require("./units/setup.js"); const utils = require("./units/utils.js"); +const pjson = require('./package.json'); const path = require("path"); const fs = require("fs"); @@ -125,7 +126,6 @@ if (cmdOptions.help) { const usage = commandLineUsage(sections); console.log(usage); } else if (cmdOptions.version) { - var pjson = require('./package.json'); console.log(vsprintf('\nConceal node guardian version %s\n', [pjson.version])); } else { const rootPath = process.cwd(); @@ -212,7 +212,7 @@ if (cmdOptions.help) { // createGuardInstance function var createGuardInstance = function () { - guardInstance = new mainEngine.NodeGuard(cmdOptions, configOpts, rootPath); + guardInstance = new mainEngine.NodeGuard(cmdOptions, configOpts, rootPath, pjson.version); }; if (!fs.existsSync(nodePath)) { diff --git a/units/engine.js b/units/engine.js index b53a0e2..bff152f 100644 --- a/units/engine.js +++ b/units/engine.js @@ -18,7 +18,7 @@ const path = require("path"); const fs = require("fs"); const os = require("os"); -exports.NodeGuard = function (cmdOptions, configOpts, rootPath) { +exports.NodeGuard = function (cmdOptions, configOpts, rootPath, guardVersion) { const nodeUniqueId = utils.ensureNodeUniqueId(); var starupTime = moment(); var errorCount = 0; @@ -78,6 +78,7 @@ exports.NodeGuard = function (cmdOptions, configOpts, rootPath) { id: nodeUniqueId, os: process.platform, name: configOpts.node.name || os.hostname(), + version: guardVersion, nodeHost: externalIP, nodePort: configOpts.node.port, status: {