diff --git a/public/red/main.js b/public/red/main.js index 43dd9e030..5414b3a8c 100644 --- a/public/red/main.js +++ b/public/red/main.js @@ -146,6 +146,7 @@ var RED = function() { function loadSettings() { $.get('settings', function(data) { RED.settings = data; + console.log("Node-RED: "+data.version); loadNodes(); }); } diff --git a/red/red.js b/red/red.js index 266965ed0..d20a528c3 100644 --- a/red/red.js +++ b/red/red.js @@ -34,20 +34,20 @@ var RED = { init: function(httpServer,userSettings) { settings = userSettings; + + var p = require(path.join(process.env.NODE_RED_HOME,"package.json")); + if (fs.existsSync(path.join(process.env.NODE_RED_HOME,".git"))) { + settings.version = p.version+".git"; + } else { + settings.version = p.version; + } + + server.init(httpServer,settings); library.init(); return server.app; }, - version: function() { - var p = require(path.join(process.env.NODE_RED_HOME,"package.json")); - if (fs.existsSync(path.join(process.env.NODE_RED_HOME,".git"))) { - return p.version+".git"; - } else { - return p.version; - } - }, - start: server.start, stop: server.stop, nodes: nodes, diff --git a/red/server.js b/red/server.js index 3ea8627bc..03b7805bb 100644 --- a/red/server.js +++ b/red/server.js @@ -67,7 +67,9 @@ function start() { storage.init(settings).then(function() { console.log("\nWelcome to Node-RED\n===================\n"); - util.log("[red] Version: "+RED.version()); + if (settings.version) { + util.log("[red] Version: "+settings.version); + } util.log("[red] Loading palette nodes"); redNodes.init(settings,storage); redNodes.load().then(function(nodeErrors) { diff --git a/red/ui.js b/red/ui.js index d35f03368..1879f5102 100644 --- a/red/ui.js +++ b/red/ui.js @@ -63,7 +63,8 @@ function setupUI(settings) { app.get("/settings", function(req,res) { var safeSettings = { - httpNodeRoot: settings.httpNodeRoot + httpNodeRoot: settings.httpNodeRoot, + version: settings.version }; res.json(safeSettings); });