General updates for flows
[oam.git] / solution / smo / apps / flows / data / settings.js
1 /**
2  * This is the default settings file provided by Node-RED.
3  *
4  * It can contain any valid JavaScript code that will get run when Node-RED
5  * is started.
6  *
7  * Lines that start with // are commented out.
8  * Each entry should be separated from the entries above and below by a comma ','
9  *
10  * For more information about individual settings, refer to the documentation:
11  *    https://nodered.org/docs/user-guide/runtime/configuration
12  *
13  * The settings are split into the following sections:
14  *  - Flow File and User Directory Settings
15  *  - Security
16  *  - Server Settings
17  *  - Runtime Settings
18  *  - Editor Settings
19  *  - Node Settings
20  *
21  **/
22
23 module.exports = {
24
25   /*******************************************************************************
26    * Flow File and User Directory Settings
27    *  - flowFile
28    *  - credentialSecret
29    *  - flowFilePretty
30    *  - userDir
31    *  - nodesDir
32    ******************************************************************************/
33
34   /** The file containing the flows. If not set, defaults to flows_<hostname>.json **/
35   flowFile: 'flows.json',
36
37   /** By default, credentials are encrypted in storage using a generated key. To
38    * specify your own secret, set the following property.
39    * If you want to disable encryption of credentials, set this property to false.
40    * Note: once you set this property, do not change it - doing so will prevent
41    * node-red from being able to decrypt your existing credentials and they will be
42    * lost.
43    */
44   //credentialSecret: "a-secret-key",
45
46   /** By default, the flow JSON will be formatted over multiple lines making
47    * it easier to compare changes when using version control.
48    * To disable pretty-printing of the JSON set the following property to false.
49    */
50   flowFilePretty: true,
51
52   /** By default, all user data is stored in a directory called `.node-red` under
53    * the user's home directory. To use a different location, the following
54    * property can be used
55    */
56   //userDir: '/home/nol/.node-red/',
57
58   /** Node-RED scans the `nodes` directory in the userDir to find local node files.
59    * The following property can be used to specify an additional directory to scan.
60    */
61   //nodesDir: '/home/nol/.node-red/nodes',
62
63   /*******************************************************************************
64    * Security
65    *  - adminAuth
66    *  - https
67    *  - httpsRefreshInterval
68    *  - requireHttps
69    *  - httpNodeAuth
70    *  - httpStaticAuth
71    ******************************************************************************/
72
73   /** To password protect the Node-RED editor and admin API, the following
74    * property can be used. See http://nodered.org/docs/security.html for details.
75    */
76   adminAuth: {
77     type: "credentials",
78     users: [{
79       username: "admin",
80       password: "$2b$08$Nx6SkcdDhsHBFPj/smAtL.5vUWFO8AiW7MQf48l3vlJpR1wSKMNsa",
81       permissions: "*"
82     }]
83   },
84
85   /** The following property can be used to enable HTTPS
86    * This property can be either an object, containing both a (private) key
87    * and a (public) certificate, or a function that returns such an object.
88    * See http://nodejs.org/api/https.html#https_https_createserver_options_requestlistener
89    * for details of its contents.
90    */
91
92   /** Option 1: static object */
93     //https: {
94     //  key: require("fs").readFileSync('privkey.pem'),
95     //  cert: require("fs").readFileSync('cert.pem')
96     //},
97
98   /** Option 2: function that returns the HTTP configuration object */
99   // https: function() {
100   //     // This function should return the options object, or a Promise
101   //     // that resolves to the options object
102   //     return {
103   //         key: require("fs").readFileSync('privkey.pem'),
104   //         cert: require("fs").readFileSync('cert.pem')
105   //     }
106   // },
107
108   /** If the `https` setting is a function, the following setting can be used
109    * to set how often, in hours, the function will be called. That can be used
110    * to refresh any certificates.
111    */
112   //httpsRefreshInterval : 12,
113
114   /** The following property can be used to cause insecure HTTP connections to
115    * be redirected to HTTPS.
116    */
117   //requireHttps: true,
118
119   /** To password protect the node-defined HTTP endpoints (httpNodeRoot),
120    * including node-red-dashboard, or the static content (httpStatic), the
121    * following properties can be used.
122    * The `pass` field is a bcrypt hash of the password.
123    * See http://nodered.org/docs/security.html#generating-the-password-hash
124    */
125   //httpNodeAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."},
126   //httpStaticAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."},
127
128   /*******************************************************************************
129    * Server Settings
130    *  - uiPort
131    *  - uiHost
132    *  - apiMaxLength
133    *  - httpServerOptions
134    *  - httpAdminRoot
135    *  - httpAdminMiddleware
136    *  - httpNodeRoot
137    *  - httpNodeCors
138    *  - httpNodeMiddleware
139    *  - httpStatic
140    *  - httpStaticRoot
141    ******************************************************************************/
142
143   /** the tcp port that the Node-RED web server is listening on */
144   uiPort: process.env.PORT || 1880,
145
146   /** By default, the Node-RED UI accepts connections on all IPv4 interfaces.
147    * To listen on all IPv6 addresses, set uiHost to "::",
148    * The following property can be used to listen on a specific interface. For
149    * example, the following would only allow connections from the local machine.
150    */
151   //uiHost: "127.0.0.1",
152
153   /** The maximum size of HTTP request that will be accepted by the runtime api.
154    * Default: 5mb
155    */
156   //apiMaxLength: '5mb',
157
158   /** The following property can be used to pass custom options to the Express.js
159    * server used by Node-RED. For a full list of available options, refer
160    * to http://expressjs.com/en/api.html#app.settings.table
161    */
162   //httpServerOptions: { },
163
164   /** By default, the Node-RED UI is available at http://localhost:1880/
165    * The following property can be used to specify a different root path.
166    * If set to false, this is disabled.
167    */
168   //httpAdminRoot: '/admin',
169
170   /** The following property can be used to add a custom middleware function
171    * in front of all admin http routes. For example, to set custom http
172    * headers. It can be a single function or an array of middleware functions.
173    */
174   // httpAdminMiddleware: function(req,res,next) {
175   //    // Set the X-Frame-Options header to limit where the editor
176   //    // can be embedded
177   //    //res.set('X-Frame-Options', 'sameorigin');
178   //    next();
179   // },
180
181
182   /** Some nodes, such as HTTP In, can be used to listen for incoming http requests.
183    * By default, these are served relative to '/'. The following property
184    * can be used to specify a different root path. If set to false, this is
185    * disabled.
186    */
187   //httpNodeRoot: '/red-nodes',
188
189   /** The following property can be used to configure cross-origin resource sharing
190    * in the HTTP nodes.
191    * See https://github.com/troygoode/node-cors#configuration-options for
192    * details on its contents. The following is a basic permissive set of options:
193    */
194   //httpNodeCors: {
195   //    origin: "*",
196   //    methods: "GET,PUT,POST,DELETE"
197   //},
198
199   /** If you need to set an http proxy please set an environment variable
200    * called http_proxy (or HTTP_PROXY) outside of Node-RED in the operating system.
201    * For example - http_proxy=http://myproxy.com:8080
202    * (Setting it here will have no effect)
203    * You may also specify no_proxy (or NO_PROXY) to supply a comma separated
204    * list of domains to not proxy, eg - no_proxy=.acme.co,.acme.co.uk
205    */
206
207   /** The following property can be used to add a custom middleware function
208    * in front of all http in nodes. This allows custom authentication to be
209    * applied to all http in nodes, or any other sort of common request processing.
210    * It can be a single function or an array of middleware functions.
211    */
212   //httpNodeMiddleware: function(req,res,next) {
213   //    // Handle/reject the request, or pass it on to the http in node by calling next();
214   //    // Optionally skip our rawBodyParser by setting this to true;
215   //    //req.skipRawBodyParser = true;
216   //    next();
217   //},
218
219   /** When httpAdminRoot is used to move the UI to a different root path, the
220    * following property can be used to identify a directory of static content
221    * that should be served at http://localhost:1880/.
222    * When httpStaticRoot is set differently to httpAdminRoot, there is no need 
223    * to move httpAdminRoot
224    */
225   //httpStatic: '/home/nol/node-red-static/', //single static source
226   /* OR multiple static sources can be created using an array of objects... */
227   //httpStatic: [
228   //    {path: '/home/nol/pics/',    root: "/img/"}, 
229   //    {path: '/home/nol/reports/', root: "/doc/"}, 
230   //],
231
232   /**  
233    * All static routes will be appended to httpStaticRoot
234    * e.g. if httpStatic = "/home/nol/docs" and  httpStaticRoot = "/static/"
235    *      then "/home/nol/docs" will be served at "/static/"
236    * e.g. if httpStatic = [{path: '/home/nol/pics/', root: "/img/"}]
237    *      and httpStaticRoot = "/static/"
238    *      then "/home/nol/pics/" will be served at "/static/img/"
239    */
240   //httpStaticRoot: '/static/',
241
242   /*******************************************************************************
243    * Runtime Settings
244    *  - lang
245    *  - runtimeState
246    *  - diagnostics
247    *  - logging
248    *  - contextStorage
249    *  - exportGlobalContextKeys
250    *  - externalModules
251    ******************************************************************************/
252
253   /** Uncomment the following to run node-red in your preferred language.
254    * Available languages include: en-US (default), ja, de, zh-CN, zh-TW, ru, ko
255    * Some languages are more complete than others.
256    */
257   // lang: "de",
258
259   /** Configure diagnostics options 
260    * - enabled:  When `enabled` is `true` (or unset), diagnostics data will
261    *   be available at http://localhost:1880/diagnostics  
262    * - ui: When `ui` is `true` (or unset), the action `show-system-info` will 
263    *   be available to logged in users of node-red editor  
264   */
265   diagnostics: {
266     /** enable or disable diagnostics endpoint. Must be set to `false` to disable */
267     enabled: true,
268     /** enable or disable diagnostics display in the node-red editor. Must be set to `false` to disable */
269     ui: true,
270   },
271   /** Configure runtimeState options 
272    * - enabled:  When `enabled` is `true` flows runtime can be Started/Stoped 
273    *   by POSTing to available at http://localhost:1880/flows/state  
274    * - ui: When `ui` is `true`, the action `core:start-flows` and 
275    *   `core:stop-flows` will be available to logged in users of node-red editor
276    *   Also, the deploy menu (when set to default) will show a stop or start button
277    */
278   runtimeState: {
279     /** enable or disable flows/state endpoint. Must be set to `false` to disable */
280     enabled: false,
281     /** show or hide runtime stop/start options in the node-red editor. Must be set to `false` to hide */
282     ui: false,
283   },
284   /** Configure the logging output */
285   logging: {
286     /** Only console logging is currently supported */
287     console: {
288       /** Level of logging to be recorded. Options are:
289        * fatal - only those errors which make the application unusable should be recorded
290        * error - record errors which are deemed fatal for a particular request + fatal errors
291        * warn - record problems which are non fatal + errors + fatal errors
292        * info - record information about the general running of the application + warn + error + fatal errors
293        * debug - record information which is more verbose than info + info + warn + error + fatal errors
294        * trace - record very detailed logging + debug + info + warn + error + fatal errors
295        * off - turn off all logging (doesn't affect metrics or audit)
296        */
297       level: 'off',
298       /** Whether or not to include metric events in the log output */
299       metrics: false,
300       /** Whether or not to include audit events in the log output */
301       audit: false
302     },
303     myCustomLogger: {
304       level: 'info',
305       metrics: false,
306       handler: (settings) => {
307         let level = 'ALL  ';
308         const levelIds = [10, 20, 30, 40, 50, 60];
309         const levelLabels = ['FATAL', 'ERROR', 'WARN ', 'INFO ', 'DEBUG', 'TRACE'];
310         return function (msg) {
311           if (levelIds.indexOf(msg.level) !== -1) {
312             level = levelLabels[levelIds.indexOf(msg.level)];
313           }
314           const logEntry = [new Date(msg.timestamp).toISOString(), level, msg.msg.toString()].join(' | ');
315           console.log(logEntry);
316         }
317       }
318     }
319   },
320
321   /** Context Storage
322    * The following property can be used to enable context storage. The configuration
323    * provided here will enable file-based context that flushes to disk every 30 seconds.
324    * Refer to the documentation for further options: https://nodered.org/docs/api/context/
325    */
326   //contextStorage: {
327   //    default: {
328   //        module:"localfilesystem"
329   //    },
330   //},
331
332   /** `global.keys()` returns a list of all properties set in global context.
333    * This allows them to be displayed in the Context Sidebar within the editor.
334    * In some circumstances it is not desirable to expose them to the editor. The
335    * following property can be used to hide any property set in `functionGlobalContext`
336    * from being list by `global.keys()`.
337    * By default, the property is set to false to avoid accidental exposure of
338    * their values. Setting this to true will cause the keys to be listed.
339    */
340   exportGlobalContextKeys: false,
341
342   /** Configure how the runtime will handle external npm modules.
343    * This covers:
344    *  - whether the editor will allow new node modules to be installed
345    *  - whether nodes, such as the Function node are allowed to have their
346    * own dynamically configured dependencies.
347    * The allow/denyList options can be used to limit what modules the runtime
348    * will install/load. It can use '*' as a wildcard that matches anything.
349    */
350   externalModules: {
351     // autoInstall: false,   /** Whether the runtime will attempt to automatically install missing modules */
352     // autoInstallRetry: 30, /** Interval, in seconds, between reinstall attempts */
353     // palette: {              /** Configuration for the Palette Manager */
354     //     allowInstall: true, /** Enable the Palette Manager in the editor */
355     //     allowUpdate: true,  /** Allow modules to be updated in the Palette Manager */
356     //     allowUpload: true,  /** Allow module tgz files to be uploaded and installed */
357     //     allowList: ['*'],
358     //     denyList: [],
359     //     allowUpdateList: ['*'],
360     //     denyUpdateList: []
361     // },
362     // modules: {              /** Configuration for node-specified modules */
363     //     allowInstall: true,
364     //     allowList: [],
365     //     denyList: []
366     // }
367   },
368
369
370   /*******************************************************************************
371    * Editor Settings
372    *  - disableEditor
373    *  - editorTheme
374    ******************************************************************************/
375
376   /** The following property can be used to disable the editor. The admin API
377    * is not affected by this option. To disable both the editor and the admin
378    * API, use either the httpRoot or httpAdminRoot properties
379    */
380   //disableEditor: false,
381
382   /** Customising the editor
383    * See https://nodered.org/docs/user-guide/runtime/configuration#editor-themes
384    * for all available options.
385    */
386   editorTheme: {
387     /** The following property can be used to set a custom theme for the editor.
388      * See https://github.com/node-red-contrib-themes/theme-collection for
389      * a collection of themes to chose from.
390      */
391     //theme: "",
392
393     /** To disable the 'Welcome to Node-RED' tour that is displayed the first
394      * time you access the editor for each release of Node-RED, set this to false
395      */
396     //tours: false,
397
398     palette: {
399       /** The following property can be used to order the categories in the editor
400        * palette. If a node's category is not in the list, the category will get
401        * added to the end of the palette.
402        * If not set, the following default order is used:
403        */
404       //categories: ['subflows', 'common', 'function', 'network', 'sequence', 'parser', 'storage'],
405     },
406
407     projects: {
408       /** To enable the Projects feature, set this value to true */
409       enabled: false,
410       workflow: {
411         /** Set the default projects workflow mode.
412          *  - manual - you must manually commit changes
413          *  - auto - changes are automatically committed
414          * This can be overridden per-user from the 'Git config'
415          * section of 'User Settings' within the editor
416          */
417         mode: "manual"
418       }
419     },
420
421     codeEditor: {
422       /** Select the text editor component used by the editor.
423        * As of Node-RED V3, this defaults to "monaco", but can be set to "ace" if desired
424        */
425       lib: "monaco",
426       options: {
427         /** The follow options only apply if the editor is set to "monaco"
428          *
429          * theme - must match the file name of a theme in
430          * packages/node_modules/@node-red/editor-client/src/vendor/monaco/dist/theme
431          * e.g. "tomorrow-night", "upstream-sunburst", "github", "my-theme"
432          */
433         // theme: "vs",
434         /** other overrides can be set e.g. fontSize, fontFamily, fontLigatures etc.
435          * for the full list, see https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.IStandaloneEditorConstructionOptions.html
436          */
437         //fontSize: 14,
438         //fontFamily: "Cascadia Code, Fira Code, Consolas, 'Courier New', monospace",
439         //fontLigatures: true,
440       }
441     }
442   },
443
444   /*******************************************************************************
445    * Node Settings
446    *  - fileWorkingDirectory
447    *  - functionGlobalContext
448    *  - functionExternalModules
449    *  - nodeMessageBufferMaxLength
450    *  - ui (for use with Node-RED Dashboard)
451    *  - debugUseColors
452    *  - debugMaxLength
453    *  - execMaxBufferSize
454    *  - httpRequestTimeout
455    *  - mqttReconnectTime
456    *  - serialReconnectTime
457    *  - socketReconnectTime
458    *  - socketTimeout
459    *  - tcpMsgQueueSize
460    *  - inboundWebSocketTimeout
461    *  - tlsConfigDisableLocalFiles
462    *  - webSocketNodeVerifyClient
463    ******************************************************************************/
464
465   /** The working directory to handle relative file paths from within the File nodes
466    * defaults to the working directory of the Node-RED process.
467    */
468   //fileWorkingDirectory: "",
469
470   /** Allow the Function node to load additional npm modules directly */
471   functionExternalModules: true,
472
473   /** The following property can be used to set predefined values in Global Context.
474    * This allows extra node modules to be made available with in Function node.
475    * For example, the following:
476    *    functionGlobalContext: { os:require('os') }
477    * will allow the `os` module to be accessed in a Function node using:
478    *    global.get("os")
479    */
480   functionGlobalContext: {
481     os: require('os'),
482   },
483
484   /** The maximum number of messages nodes will buffer internally as part of their
485    * operation. This applies across a range of nodes that operate on message sequences.
486    * defaults to no limit. A value of 0 also means no limit is applied.
487    */
488   //nodeMessageBufferMaxLength: 0,
489
490   /** If you installed the optional node-red-dashboard you can set it's path
491    * relative to httpNodeRoot
492    * Other optional properties include
493    *  readOnly:{boolean},
494    *  middleware:{function or array}, (req,res,next) - http middleware
495    *  ioMiddleware:{function or array}, (socket,next) - socket.io middleware
496    */
497   //ui: { path: "ui" },
498
499   /** Colourise the console output of the debug node */
500   //debugUseColors: true,
501
502   /** The maximum length, in characters, of any message sent to the debug sidebar tab */
503   debugMaxLength: 1000,
504
505   /** Maximum buffer size for the exec node. Defaults to 10Mb */
506   //execMaxBufferSize: 10000000,
507
508   /** Timeout in milliseconds for HTTP request connections. Defaults to 120s */
509   //httpRequestTimeout: 120000,
510
511   /** Retry time in milliseconds for MQTT connections */
512   mqttReconnectTime: 15000,
513
514   /** Retry time in milliseconds for Serial port connections */
515   serialReconnectTime: 15000,
516
517   /** Retry time in milliseconds for TCP socket connections */
518   //socketReconnectTime: 10000,
519
520   /** Timeout in milliseconds for TCP server socket connections. Defaults to no timeout */
521   //socketTimeout: 120000,
522
523   /** Maximum number of messages to wait in queue while attempting to connect to TCP socket
524    * defaults to 1000
525    */
526   //tcpMsgQueueSize: 2000,
527
528   /** Timeout in milliseconds for inbound WebSocket connections that do not
529    * match any configured node. Defaults to 5000
530    */
531   //inboundWebSocketTimeout: 5000,
532
533   /** To disable the option for using local files for storing keys and
534    * certificates in the TLS configuration node, set this to true.
535    */
536   //tlsConfigDisableLocalFiles: true,
537
538   /** The following property can be used to verify websocket connection attempts.
539    * This allows, for example, the HTTP request headers to be checked to ensure
540    * they include valid authentication information.
541    */
542   //webSocketNodeVerifyClient: function(info) {
543   //    /** 'info' has three properties:
544   //    *   - origin : the value in the Origin header
545   //    *   - req : the HTTP request
546   //    *   - secure : true if req.connection.authorized or req.connection.encrypted is set
547   //    *
548   //    * The function should return true if the connection should be accepted, false otherwise.
549   //    *
550   //    * Alternatively, if this function is defined to accept a second argument, callback,
551   //    * it can be used to verify the client asynchronously.
552   //    * The callback takes three arguments:
553   //    *   - result : boolean, whether to accept the connection or not
554   //    *   - code : if result is false, the HTTP error status to return
555   //    *   - reason: if result is false, the HTTP reason string to return
556   //    */
557   //},
558 }