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

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
This commit is contained in:
Nick O'Leary 2019-10-03 20:31:16 +01:00 committed by Dave Conway-Jones
parent 88609a8829
commit c7bbe2f1fe

View File

@ -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);});