mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Add --safe mode flag to allow starting without flows running
This commit is contained in:
@@ -68,7 +68,7 @@ var api = module.exports = {
|
||||
|
||||
var apiPromise;
|
||||
if (deploymentType === 'reload') {
|
||||
apiPromise = runtime.nodes.loadFlows();
|
||||
apiPromise = runtime.nodes.loadFlows(true);
|
||||
} else {
|
||||
if (flows.hasOwnProperty('rev')) {
|
||||
var currentVersion = runtime.nodes.getFlows().rev;
|
||||
|
@@ -102,6 +102,10 @@ function loadFlows() {
|
||||
});
|
||||
}
|
||||
function load(forceStart) {
|
||||
if (forceStart && settings.safeMode) {
|
||||
// This is a force reload from the API - disable safeMode
|
||||
delete settings.safeMode;
|
||||
}
|
||||
return setFlows(null,"load",false,forceStart);
|
||||
}
|
||||
|
||||
@@ -112,6 +116,16 @@ function load(forceStart) {
|
||||
*/
|
||||
function setFlows(_config,type,muteLog,forceStart) {
|
||||
type = type||"full";
|
||||
if (settings.safeMode) {
|
||||
if (type !== "load") {
|
||||
// If in safeMode, the flows are stopped. We cannot do a modified nodes/flows
|
||||
// type deploy as nothing is running. Can only do a "load" or "full" deploy.
|
||||
// The "load" case is already handled in `load()` to distinguish between
|
||||
// startup-load and api-request-load.
|
||||
type = "full";
|
||||
delete settings.safeMode;
|
||||
}
|
||||
}
|
||||
|
||||
var configSavePromise = null;
|
||||
var config = null;
|
||||
@@ -285,6 +299,13 @@ function start(type,diff,muteLog) {
|
||||
events.emit("runtime-event",{id:"runtime-state",payload:{error:"missing-types", type:"warning",text:"notification.warnings.missing-types",types:activeFlowConfig.missingTypes},retain:true});
|
||||
return when.resolve();
|
||||
}
|
||||
if (settings.safeMode) {
|
||||
log.info("*****************************************************************")
|
||||
log.info(log._("nodes.flows.safe-mode"));
|
||||
log.info("*****************************************************************")
|
||||
events.emit("runtime-event",{id:"runtime-state",payload:{error:"safe-mode", type:"warning",text:"notification.warnings.safe-mode"},retain:true});
|
||||
return Promise.resolve();
|
||||
}
|
||||
if (!muteLog) {
|
||||
if (type !== "full") {
|
||||
log.info(log._("nodes.flows.starting-modified-"+type));
|
||||
|
Reference in New Issue
Block a user