2 * This is the default settings file provided by Node-RED.
4 * It can contain any valid JavaScript code that will get run when Node-RED
7 * Lines that start with // are commented out.
8 * Each entry should be separated from the entries above and below by a comma ','
10 * For more information about individual settings, refer to the documentation:
11 * https://nodered.org/docs/user-guide/runtime/configuration
13 * The settings are split into the following sections:
14 * - Flow File and User Directory Settings
25 /*******************************************************************************
26 * Flow File and User Directory Settings
32 ******************************************************************************/
34 /** The file containing the flows. If not set, defaults to flows_<hostname>.json **/
35 flowFile: 'flows.json',
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
44 //credentialSecret: "a-secret-key",
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.
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
56 //userDir: '/home/nol/.node-red/',
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.
61 //nodesDir: '/home/nol/.node-red/nodes',
63 /*******************************************************************************
67 * - httpsRefreshInterval
71 ******************************************************************************/
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.
80 password: "$2b$08$Nx6SkcdDhsHBFPj/smAtL.5vUWFO8AiW7MQf48l3vlJpR1wSKMNsa",
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.
92 /** Option 1: static object */
94 // key: require("fs").readFileSync('privkey.pem'),
95 // cert: require("fs").readFileSync('cert.pem')
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
103 // key: require("fs").readFileSync('privkey.pem'),
104 // cert: require("fs").readFileSync('cert.pem')
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.
112 //httpsRefreshInterval : 12,
114 /** The following property can be used to cause insecure HTTP connections to
115 * be redirected to HTTPS.
117 //requireHttps: true,
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
125 //httpNodeAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."},
126 //httpStaticAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."},
128 /*******************************************************************************
133 * - httpServerOptions
135 * - httpAdminMiddleware
138 * - httpNodeMiddleware
141 ******************************************************************************/
143 /** the tcp port that the Node-RED web server is listening on */
144 uiPort: process.env.PORT || 1880,
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.
151 //uiHost: "127.0.0.1",
153 /** The maximum size of HTTP request that will be accepted by the runtime api.
156 //apiMaxLength: '5mb',
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
162 //httpServerOptions: { },
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.
168 //httpAdminRoot: '/admin',
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.
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');
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
187 //httpNodeRoot: '/red-nodes',
189 /** The following property can be used to configure cross-origin resource sharing
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:
196 // methods: "GET,PUT,POST,DELETE"
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
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.
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;
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
225 //httpStatic: '/home/nol/node-red-static/', //single static source
226 /* OR multiple static sources can be created using an array of objects... */
228 // {path: '/home/nol/pics/', root: "/img/"},
229 // {path: '/home/nol/reports/', root: "/doc/"},
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/"
240 //httpStaticRoot: '/static/',
242 /*******************************************************************************
249 * - exportGlobalContextKeys
251 ******************************************************************************/
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.
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
266 /** enable or disable diagnostics endpoint. Must be set to `false` to disable */
268 /** enable or disable diagnostics display in the node-red editor. Must be set to `false` to disable */
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
279 /** enable or disable flows/state endpoint. Must be set to `false` to disable */
281 /** show or hide runtime stop/start options in the node-red editor. Must be set to `false` to hide */
284 /** Configure the logging output */
286 /** Only console logging is currently supported */
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)
298 /** Whether or not to include metric events in the log output */
300 /** Whether or not to include audit events in the log output */
306 handler: (settings) => {
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)];
314 const logEntry = [new Date(msg.timestamp).toISOString(), level, msg.msg.toString()].join(' | ');
315 console.log(logEntry);
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/
328 // module:"localfilesystem"
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.
340 exportGlobalContextKeys: false,
342 /** Configure how the runtime will handle external npm modules.
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.
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 */
359 // allowUpdateList: ['*'],
360 // denyUpdateList: []
362 // modules: { /** Configuration for node-specified modules */
363 // allowInstall: true,
370 /*******************************************************************************
374 ******************************************************************************/
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
380 //disableEditor: false,
382 /** Customising the editor
383 * See https://nodered.org/docs/user-guide/runtime/configuration#editor-themes
384 * for all available options.
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.
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
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:
404 //categories: ['subflows', 'common', 'function', 'network', 'sequence', 'parser', 'storage'],
408 /** To enable the Projects feature, set this value to true */
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
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
427 /** The follow options only apply if the editor is set to "monaco"
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"
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
438 //fontFamily: "Cascadia Code, Fira Code, Consolas, 'Courier New', monospace",
439 //fontLigatures: true,
444 /*******************************************************************************
446 * - fileWorkingDirectory
447 * - functionGlobalContext
448 * - functionExternalModules
449 * - nodeMessageBufferMaxLength
450 * - ui (for use with Node-RED Dashboard)
453 * - execMaxBufferSize
454 * - httpRequestTimeout
455 * - mqttReconnectTime
456 * - serialReconnectTime
457 * - socketReconnectTime
460 * - inboundWebSocketTimeout
461 * - tlsConfigDisableLocalFiles
462 * - webSocketNodeVerifyClient
463 ******************************************************************************/
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.
468 //fileWorkingDirectory: "",
470 /** Allow the Function node to load additional npm modules directly */
471 functionExternalModules: true,
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:
480 functionGlobalContext: {
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.
488 //nodeMessageBufferMaxLength: 0,
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
497 //ui: { path: "ui" },
499 /** Colourise the console output of the debug node */
500 //debugUseColors: true,
502 /** The maximum length, in characters, of any message sent to the debug sidebar tab */
503 debugMaxLength: 1000,
505 /** Maximum buffer size for the exec node. Defaults to 10Mb */
506 //execMaxBufferSize: 10000000,
508 /** Timeout in milliseconds for HTTP request connections. Defaults to 120s */
509 //httpRequestTimeout: 120000,
511 /** Retry time in milliseconds for MQTT connections */
512 mqttReconnectTime: 15000,
514 /** Retry time in milliseconds for Serial port connections */
515 serialReconnectTime: 15000,
517 /** Retry time in milliseconds for TCP socket connections */
518 //socketReconnectTime: 10000,
520 /** Timeout in milliseconds for TCP server socket connections. Defaults to no timeout */
521 //socketTimeout: 120000,
523 /** Maximum number of messages to wait in queue while attempting to connect to TCP socket
526 //tcpMsgQueueSize: 2000,
528 /** Timeout in milliseconds for inbound WebSocket connections that do not
529 * match any configured node. Defaults to 5000
531 //inboundWebSocketTimeout: 5000,
533 /** To disable the option for using local files for storing keys and
534 * certificates in the TLS configuration node, set this to true.
536 //tlsConfigDisableLocalFiles: true,
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.
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
548 // * The function should return true if the connection should be accepted, false otherwise.
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