1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Add version information to /settings

This commit is contained in:
Nick O'Leary 2014-07-17 21:32:30 +01:00
parent 8b6c14b05d
commit 84a0e8ceff
4 changed files with 15 additions and 11 deletions

View File

@ -146,6 +146,7 @@ var RED = function() {
function loadSettings() { function loadSettings() {
$.get('settings', function(data) { $.get('settings', function(data) {
RED.settings = data; RED.settings = data;
console.log("Node-RED: "+data.version);
loadNodes(); loadNodes();
}); });
} }

View File

@ -34,20 +34,20 @@ var RED = {
init: function(httpServer,userSettings) { init: function(httpServer,userSettings) {
settings = 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); server.init(httpServer,settings);
library.init(); library.init();
return server.app; 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, start: server.start,
stop: server.stop, stop: server.stop,
nodes: nodes, nodes: nodes,

View File

@ -67,7 +67,9 @@ function start() {
storage.init(settings).then(function() { storage.init(settings).then(function() {
console.log("\nWelcome to Node-RED\n===================\n"); 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"); util.log("[red] Loading palette nodes");
redNodes.init(settings,storage); redNodes.init(settings,storage);
redNodes.load().then(function(nodeErrors) { redNodes.load().then(function(nodeErrors) {

View File

@ -63,7 +63,8 @@ function setupUI(settings) {
app.get("/settings", function(req,res) { app.get("/settings", function(req,res) {
var safeSettings = { var safeSettings = {
httpNodeRoot: settings.httpNodeRoot httpNodeRoot: settings.httpNodeRoot,
version: settings.version
}; };
res.json(safeSettings); res.json(safeSettings);
}); });