From c7bbe2f1fea014fa1559dc8c56c45f23b2abe41c Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 3 Oct 2019 20:31:16 +0100 Subject: [PATCH] Add env vars to enable safe mode and projects (#2301) * Add NODE_RED_ENABLE_SAFE_MODE and NODE_RED_ENABLE_PROJECTS * Allow env-vars to be set to false to disable features --- packages/node_modules/node-red/red.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/node_modules/node-red/red.js b/packages/node_modules/node-red/red.js index 94cebdfaa..26b6d1fc8 100755 --- a/packages/node_modules/node-red/red.js +++ b/packages/node_modules/node-red/red.js @@ -133,9 +133,14 @@ try { if (parsedArgs.verbose) { settings.verbose = true; } -if (parsedArgs.safe) { +if (parsedArgs.safe || (process.env.NODE_RED_ENABLE_SAFE_MODE && !/^false$/i.test(process.env.NODE_RED_ENABLE_SAFE_MODE) )) { settings.safeMode = true; } +if (process.env.NODE_RED_ENABLE_PROJECTS) { + settings.editorTheme = settings.editorTheme || {}; + settings.editorTheme.projects = settings.editorTheme.projects || {}; + settings.editorTheme.projects.enabled = !/^false$/i.test(process.env.NODE_RED_ENABLE_PROJECTS); +} if (settings.https) { server = https.createServer(settings.https,function(req,res) {app(req,res);});