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

loadNodeConfig assumed to always be called with module and name parameters

This commit is contained in:
Anna Thomas 2014-11-19 13:54:00 +00:00
parent 71bd5cd9e9
commit 9552055b08

View File

@ -475,9 +475,7 @@ function loadNodesFromModule(moduleDir,pkg) {
* } * }
*/ */
function loadNodeConfig(file,module,name) { function loadNodeConfig(file,module,name) {
var id = crypto.createHash('sha1').update(file).digest("hex"); var id = crypto.createHash('sha1').update(module+":"+name).digest("hex");
if (module && name) {
var newid = crypto.createHash('sha1').update(module+":"+name).digest("hex");
var existingInfo = registry.getNodeInfo(id); var existingInfo = registry.getNodeInfo(id);
if (existingInfo) { if (existingInfo) {
// For a brief period, id for modules were calculated incorrectly. // For a brief period, id for modules were calculated incorrectly.
@ -485,9 +483,6 @@ function loadNodeConfig(file,module,name) {
registry.removeNode(id); registry.removeNode(id);
registry.saveNodeList(); registry.saveNodeList();
} }
id = newid;
}
var info = registry.getNodeInfo(id); var info = registry.getNodeInfo(id);
var isEnabled = true; var isEnabled = true;
@ -507,12 +502,8 @@ function loadNodeConfig(file,module,name) {
loaded:false loaded:false
}; };
if (module) {
node.name = module+":"+name; node.name = module+":"+name;
node.module = module; node.module = module;
} else {
node.name = path.basename(file);
}
try { try {
var content = fs.readFileSync(node.template,'utf8'); var content = fs.readFileSync(node.template,'utf8');