mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Create a copy of the previous flow file (flow.previous) before each deploy
closes #184 In case of emergency you can now find the previous flow file before you hit deploy in a file called flow.previous . As indicated it is the flow that was running prior to you hitting deploy...
This commit is contained in:
parent
44e8aeaae4
commit
67d1e2acd8
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,6 +1,7 @@
|
|||||||
node_modules
|
node_modules
|
||||||
credentials.json
|
credentials.json
|
||||||
flows*.json
|
flows*.json
|
||||||
|
flow.backup
|
||||||
*_cred*
|
*_cred*
|
||||||
nodes/node-red-nodes/
|
nodes/node-red-nodes/
|
||||||
.npm
|
.npm
|
||||||
|
@ -27,6 +27,7 @@ var promiseDir = nodeFn.lift(mkdirp);
|
|||||||
var settings;
|
var settings;
|
||||||
var flowsFile;
|
var flowsFile;
|
||||||
var flowsFullPath;
|
var flowsFullPath;
|
||||||
|
var flowsPrev;
|
||||||
var credentialsFile;
|
var credentialsFile;
|
||||||
var oldCredentialsFile;
|
var oldCredentialsFile;
|
||||||
var userDir;
|
var userDir;
|
||||||
@ -152,6 +153,7 @@ var localfilesystem = {
|
|||||||
var fsext = fspath.extname(flowsFile);
|
var fsext = fspath.extname(flowsFile);
|
||||||
credentialsFile = fspath.join(userDir,fspath.basename(flowsFile,fsext)+"_cred"+fsext);
|
credentialsFile = fspath.join(userDir,fspath.basename(flowsFile,fsext)+"_cred"+fsext);
|
||||||
oldCredentialsFile = fspath.join(userDir,"credentials.json");
|
oldCredentialsFile = fspath.join(userDir,"credentials.json");
|
||||||
|
flowsPrev = fspath.join(userDir,"flow.backup");
|
||||||
|
|
||||||
libDir = fspath.join(userDir,"lib");
|
libDir = fspath.join(userDir,"lib");
|
||||||
libFlowsDir = fspath.join(libDir,"flows");
|
libFlowsDir = fspath.join(libDir,"flows");
|
||||||
@ -176,6 +178,7 @@ var localfilesystem = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
saveFlows: function(flows) {
|
saveFlows: function(flows) {
|
||||||
|
fs.rename(flowsFullPath,flowsPrev);
|
||||||
return nodeFn.call(fs.writeFile, flowsFullPath, JSON.stringify(flows));
|
return nodeFn.call(fs.writeFile, flowsFullPath, JSON.stringify(flows));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user