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

Add flowFilePretty option

This commit is contained in:
Nick O'Leary 2014-06-07 22:33:29 +01:00
parent fce00b2f4b
commit 749eaa2181
2 changed files with 22 additions and 2 deletions

View File

@ -181,7 +181,16 @@ var localfilesystem = {
if (fs.existsSync(flowsFullPath)) {
fs.renameSync(flowsFullPath,flowsPrev);
}
return nodeFn.call(fs.writeFile, flowsFullPath, JSON.stringify(flows));
var flowData;
if (settings.flowFilePretty) {
flowData = JSON.stringify(flows,null,4);
} else {
flowData = JSON.stringify(flows);
}
return nodeFn.call(fs.writeFile, flowsFullPath, flowData);
},
getCredentials: function() {
@ -207,7 +216,14 @@ var localfilesystem = {
},
saveCredentials: function(credentials) {
return nodeFn.call(fs.writeFile, credentialsFile, JSON.stringify(credentials))
var credentialData;
if (settings.flowFilePretty) {
credentialData = JSON.stringify(credentials,null,4);
} else {
credentialData = JSON.stringify(credentials);
}
return nodeFn.call(fs.writeFile, credentialsFile, credentialData)
},
getAllFlows: function() {

View File

@ -41,6 +41,10 @@ module.exports = {
// The file containing the flows. If not set, it defaults to flows_<hostname>.json
//flowFile: 'flows.json',
// To enabled pretty-printing of the flow within the flow file, set the following
// property to true:
//flowFilePretty: true,
// By default, all user data is stored in the Node-RED install directory. To
// use a different location, the following property can be used
//userDir: '/home/nol/.node-red/',