mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add version information to log output
This commit is contained in:
parent
c39f4f9738
commit
6a17a7d4c2
1
red.js
1
red.js
@ -44,6 +44,7 @@ nopt.invalidHandler = function(k,v,t) {
|
|||||||
var parsedArgs = nopt(knownOpts,shortHands,process.argv,2)
|
var parsedArgs = nopt(knownOpts,shortHands,process.argv,2)
|
||||||
|
|
||||||
if (parsedArgs.help) {
|
if (parsedArgs.help) {
|
||||||
|
console.log("Node-RED v"+RED.version());
|
||||||
console.log("Usage: node red.js [-v] [-?] [--settings settings.js] [flows.json]");
|
console.log("Usage: node red.js [-v] [-?] [--settings settings.js] [flows.json]");
|
||||||
console.log("");
|
console.log("");
|
||||||
console.log("Options:");
|
console.log("Options:");
|
||||||
|
10
red/red.js
10
red/red.js
@ -18,6 +18,7 @@ var events = require("./events");
|
|||||||
var server = require("./server");
|
var server = require("./server");
|
||||||
var nodes = require("./nodes");
|
var nodes = require("./nodes");
|
||||||
var library = require("./library");
|
var library = require("./library");
|
||||||
|
var fs = require("fs");
|
||||||
var settings = null;
|
var settings = null;
|
||||||
|
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
@ -34,6 +35,15 @@ var RED = {
|
|||||||
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,
|
||||||
|
@ -63,10 +63,12 @@ function createServer(_server,_settings) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function start() {
|
function start() {
|
||||||
|
var RED = require("./red");
|
||||||
var defer = when.defer();
|
var defer = when.defer();
|
||||||
|
|
||||||
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());
|
||||||
util.log("[red] Loading palette nodes");
|
util.log("[red] Loading palette nodes");
|
||||||
var nodeErrors = redNodes.load(settings);
|
var nodeErrors = redNodes.load(settings);
|
||||||
if (nodeErrors.length > 0) {
|
if (nodeErrors.length > 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user