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:
@@ -97,6 +97,7 @@
|
||||
"undeployedChanges": "node has undeployed changes",
|
||||
"nodeActionDisabled": "node actions disabled within subflow",
|
||||
"missing-types": "<p>Flows stopped due to missing node types.</p>",
|
||||
"safe-mode":"<p>Flows stopped in safe mode.</p><p>You can modify your flows and deploy the changes to restart.",
|
||||
"restartRequired": "Node-RED must be restarted to enable upgraded modules",
|
||||
"credentials_load_failed": "<p>Flows stopped as the credentials could not be decrypted.</p><p>The flow credential file is encrypted, but the project's encryption key is missing or invalid.</p>",
|
||||
"credentials_load_failed_reset":"<p>Credentials could not be decrypted</p><p>The flow credential file is encrypted, but the project's encryption key is missing or invalid.</p><p>The flow credential file will be reset on the next deployment. Any existing flow credentials will be cleared.</p>",
|
||||
|
@@ -201,7 +201,16 @@ var RED = (function() {
|
||||
id: notificationId
|
||||
}
|
||||
if (notificationId === "runtime-state") {
|
||||
if (msg.error === "missing-types") {
|
||||
if (msg.error === "safe-mode") {
|
||||
options.buttons = [
|
||||
{
|
||||
text: RED._("common.label.close"),
|
||||
click: function() {
|
||||
persistentNotifications[notificationId].hideNotification();
|
||||
}
|
||||
}
|
||||
]
|
||||
} else if (msg.error === "missing-types") {
|
||||
text+="<ul><li>"+msg.types.join("</li><li>")+"</li></ul>";
|
||||
if (!!RED.projects.getActiveProject()) {
|
||||
options.buttons = [
|
||||
|
@@ -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));
|
||||
|
@@ -88,6 +88,7 @@
|
||||
"system-key-warning": "\n\n---------------------------------------------------------------------\nYour flow credentials file is encrypted using a system-generated key.\n\nIf the system-generated key is lost for any reason, your credentials\nfile will not be recoverable, you will have to delete it and re-enter\nyour credentials.\n\nYou should set your own key using the 'credentialSecret' option in\nyour settings file. Node-RED will then re-encrypt your credentials\nfile using your chosen key the next time you deploy a change.\n---------------------------------------------------------------------\n"
|
||||
},
|
||||
"flows": {
|
||||
"safe-mode": "Flows stopped in safe mode. Deploy to start.",
|
||||
"registered-missing": "Missing type registered: __type__",
|
||||
"error": "Error loading flows: __message__",
|
||||
"starting-modified-nodes": "Starting modified nodes",
|
||||
|
Reference in New Issue
Block a user