在前一篇文章中介绍 node-red 的配置和设定的运行环境配置部分,这篇将就剩下的配置内容进行说明。
根据官方文档,ui 编辑器配置选项如下所示:
设定项:adminauth
用途:提供 ui 编辑器的登录页面
缺省值:禁用
详细可参看:
设定项:palettecategories
用途:定义 palette 中类别的顺序,当类别没有在列表中指定的时候,会添加到最后
缺省值:未设定
在未设定的情况下,缺省顺序为: [‘subflows’, ‘input’, ‘output’, ‘function’, ‘social’, ‘storage’, ‘analysis’, ‘advanced’],
注意事项:用户如果创建了一个 subflow 的种类,只有实际创建了一个 subflow 的时候,这个种类才会在 palette 中显示。
根据官方文档,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: "" // 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: ""
}
},
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: ""
},
palette: {
editable: true, // enable/disable the palette manager
catalogues: [ // alternative palette manager catalogues
''
],
theme: [ // override node colours - rules test against category/type by regexp.
{ category: ".*", type: ".*", color: "#f0f" }
]
},
projects: {
enabled: false // enable the projects feature
}
},
根据官方文档,dashboard 配置选项如下所示:
设定项:ui
用途:可以指定 node-red-dashboard 插件节点的根目录,这个设定是已经定义的 httpnoderoot 目录的相对路径
设定示例:ui : { path: “mydashboard” },
在 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
参考内容
来源:
nodered 澳门人威尼斯3966官网:
noderedgithub:
nodered 英文社区:
nodered 中文社区:https://www.iotschool.com/topics/node81
nodered 中文社区 qq 群:8604461