在前一篇文章中介绍Node-RED的配置和设定的运行环境配置部分,这篇将就剩下的配置内容进行说明。
UI编辑器配置
根据官方文档,UI编辑器配置选项如下所示:
设定项:adminAuth
- 用途:提供UI编辑器的登录页面
- 缺省值:禁用
详细可参看:设定adminAuth
设定项:paletteCategories
- 用途:定义palette中类别的顺序,当类别没有在列表中指定的时候,会添加到最后
- 缺省值:未设定
在未设定的情况下,缺省顺序为: [‘subflows’, ‘input’, ‘output’, ‘function’, ‘social’, ‘storage’, ‘analysis’, ‘advanced’], - 注意事项:用户如果创建了一个subflow的种类,只有实际创建了一个subflow的时候,这个种类才会在palette中显示。
UI编辑器主题配置
根据官方文档,UI编辑器主题配置选项可以进行设定,设定示例如下所示:
editorTheme: {
page: {
title: "Node-RED",
favicon: "/absolute/path/to/theme/icon",
css: "/absolute/path/to/custom/css/file",
scripts: [ "/absolute/path/to/custom/script/file", "/another/script/file"]
},
header: {
title: "Node-RED",
image: "/absolute/path/to/header/image", // or null to remove image
url: "http://nodered.org" // optional url to make the header text/image a link to this url
},
deployButton: {
type:"simple",
label:"Save",
icon: "/absolute/path/to/deploy/button/image" // or null to remove image
},
menu: { // Hide unwanted menu items by id. see packages/node_modules/@node-red/editor-client/src/js/red.js:loadEditor for complete list
"menu-item-import-library": false,
"menu-item-export-library": false,
"menu-item-keyboard-shortcuts": false,
"menu-item-help": {
label: "Alternative Help Link Text",
url: "http://example.com"
}
},
userMenu: false, // Hide the user-menu even if adminAuth is enabled
login: {
image: "/absolute/path/to/login/page/big/image" // a 256x256 image
},
logout: {
redirect: "http://example.com"
},
palette: {
editable: true, // Enable/disable the Palette Manager
catalogues: [ // Alternative palette manager catalogues
'https://catalogue.nodered.org/catalogue.json'
],
theme: [ // Override node colours - rules test against category/type by RegExp.
{ category: ".*", type: ".*", color: "#f0f" }
]
},
projects: {
enabled: false // Enable the projects feature
}
},
Dashboard配置
根据官方文档,Dashboard配置选项如下所示:
设定项:ui
- 用途:可以指定Node-RED-Dashboard插件节点的根目录,这个设定是已经定义的httpNodeRoot目录的相对路径
- 设定示例:ui : { path: “mydashboard” },
Node配置
在Node-RED中,任意的Node类型都可以在文件中进行定义,根据官方文档,Node配置选项如下所示:
设定项:functionGlobalContext
- 用途:用于将一组对象添加至全局函数上下文中(Function Nodes)
- 使用示例:
比如使用如下方式进行functionGlobalContext设定之后
functionGlobalContext: { osModule:require('os') }
然后在node中就可以通过如下的方式进行引用了
var myos = global.get('osModule');
- 注意事项:在0.13之前的版本使用可能会有所不同
设定项:debugMaxLength
- 用途:设定debu的侧边栏上选项页上的最大字符输出长度(Debug Nodes)
- 缺省值:1000
设定项:mqttReconnectTime
- 用途:连接中断之后,等待多长时间会再次连接,单位为毫秒(MQTT Nodes)
- 缺省值:5000
MQTT Nodes - if the connection is lost, how long to wait, in milliseconds, before attempting to reconnect. Default:
设定项:serialReconnectTime
- 用途:需要等待多长时间会再次打开序列化端口,单位为毫秒(Serial Nodes)
- 缺省值:5000
设定项:socketReconnectTime
- 用途:需要等待多长时间会再次连接,单位为毫秒(TCP Nodes)
- 缺省值:10000
- how long to wait, in milliseconds, before attempting to reconnect. Default:
设定项:socketTimeout
- 用途:设定socket的超时时长,单位为毫秒(TCP Nodes)
- 缺省值:120000
参考内容
https://nodered.org/docs/user-guide/runtime/configuration