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

Add functionExternalModules to settings and default to false

This commit is contained in:
Nick O'Leary 2021-03-01 18:24:16 +00:00
parent d5f4f987f2
commit c3adc956d7
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
3 changed files with 7 additions and 3 deletions

View File

@ -523,7 +523,7 @@
$("#node-input-noerr").val(noerr); $("#node-input-noerr").val(noerr);
this.noerr = noerr; this.noerr = noerr;
if (RED.settings.functionExternalModules !== false) { if (RED.settings.functionExternalModules === true) {
var libs = $("#node-input-libs-container").editableList("items"); var libs = $("#node-input-libs-container").editableList("items");
node.libs = []; node.libs = [];
libs.each(function(i) { libs.each(function(i) {

View File

@ -97,7 +97,7 @@ module.exports = function(RED) {
node.fin = n.finalize ? n.finalize.trim() : ""; node.fin = n.finalize ? n.finalize.trim() : "";
node.libs = n.libs || []; node.libs = n.libs || [];
if (RED.settings.functionExternalModules === false && node.libs.length > 0) { if (RED.settings.functionExternalModules !== true && node.libs.length > 0) {
throw new Error("Function node not allowed to load external modules"); throw new Error("Function node not allowed to load external modules");
} }

View File

@ -41,7 +41,7 @@ module.exports = {
// Timeout in milliseconds for HTTP request connections // Timeout in milliseconds for HTTP request connections
// defaults to 120 seconds // defaults to 120 seconds
//httpRequestTimeout: 120000, //httpRequestTimeout: 120000,
// Maximum buffer size for the exec node // Maximum buffer size for the exec node
// defaults to 10Mb // defaults to 10Mb
//execMaxBufferSize: 10000000, //execMaxBufferSize: 10000000,
@ -243,6 +243,10 @@ module.exports = {
// jfive:require("johnny-five"), // jfive:require("johnny-five"),
// j5board:require("johnny-five").Board({repl:false}) // j5board:require("johnny-five").Board({repl:false})
}, },
// Allow the Function node to load additional npm modules
functionExternalModules: false,
// `global.keys()` returns a list of all properties set in global context. // `global.keys()` returns a list of all properties set in global context.
// This allows them to be displayed in the Context Sidebar within the editor. // This allows them to be displayed in the Context Sidebar within the editor.
// In some circumstances it is not desirable to expose them to the editor. The // In some circumstances it is not desirable to expose them to the editor. The