以下属性可用于配置 Node-RED。
作为普通应用程序运行时,它从设置文件加载其配置。有关设置文件及其位置的更多信息,请阅读本指南。
作为嵌入式应用程序运行时,配置选项在调用RED.init()
时传递。但是,在此模式下运行时,某些属性将被忽略,并由嵌入式应用程序实现。
flows_<hostname>.json
$HOME/.node-red
nodes
目录中搜索。此属性允许搜索额外的目录,以便可以将节点安装在 Node-RED 安装结构之外。默认值:$HOME/.node-red/nodes
0.0.0.0
- 所有 IPv4 接口。仅限独立版.
1880
。仅限独立版.
false
,则所有管理端点都将被禁用。这包括 API 端点和编辑器 UI。要仅禁用编辑器 UI,请参阅下面的disableEditor
属性。默认值:/
adminAuth
。在编辑器 UI 上启用 HTTP 基本身份验证
httpAdminAuth: {user:"nol", pass:"5f4dcc3b5aa765d61d8327deb882cf99"}
pass
属性是实际密码的 md5 哈希值。以下命令可用于生成哈希值
node -e "console.log(require('crypto').createHash('md5').update('YOUR PASSWORD HERE','utf8').digest('hex'))"
仅限独立版.
httpAdminMiddleware: function(req,res,next) {
// Perform any processing on the request.
// Be sure to call next() if the request should be passed on
}
false
,则所有基于节点的 HTTP 端点都将被禁用。默认值:/
httpAdminAuth
。httpAdminRoot
和httpNodeRoot
设置的值。仅限独立版.
true
,则阻止运行时提供编辑器 UI。管理 API 端点保持活动状态。默认值:false
。/
提供。使用此属性时,httpAdminRoot
也必须用于使编辑器 UI 在/
以外的路径上可用。此属性也可以设置为数组以支持多个静态目录,每个目录都有自己的一组选项。选项包括本地目录的路径以提供内容,提供它们的根 URL,可选的自定义中间件函数和可选的 CORS 配置。
例如
httpStatic: [
{
path: '/opt/static/',
root: '/private/',
middleware: myCustomHttpMiddleware,
cors: {
}
}
]
仅限独立版.
httpAdminAuth
。httpNodeMiddleware: function(req,res,next) {
// Perform any processing on the request.
// Be sure to call next() if the request should be passed
// to the relevant HTTP In node.
}
默认级别是info
。对于闪存存储有限的嵌入式设备,您可能希望将其设置为fatal
以最大程度地减少写入“磁盘”。
allow/denyList 选项可用于限制运行时将安装/加载的模块。它可以使用*
作为匹配任何内容的通配符。
externalModules: {
autoInstall: false,
autoInstallRetry: 30,
palette: {
allowInstall: true,
allowUpload: true,
allowList: [],
denyList: []
},
modules: {
allowInstall: true,
allowList: [],
denyList: []
}
}
['subflows', 'common', 'function', 'network', 'sequence', 'parser', 'storage'],
注意:在用户创建子流之前,子流类别将为空且在面板中不可见。
可以使用以下设置对象更改编辑器的主题。所有部分都是可选的。
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: "https://nodered.com.cn" // 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"
}
},
tours: false, // disable the Welcome Tour for new users
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, // *Deprecated* - use externalModules.palette.allowInstall instead
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
},
theme: "", // Select a color theme for the editor. See https://github.com/node-red-contrib-themes/theme-collection for a collection of themes to choose from
codeEditor: {
lib: "ace", // Select the text editor component used by the editor. Defaults to "ace", but can be set to "ace" or "monaco"
options: {
// The following only apply if the editor is set to "monaco"
theme: "vs", // Select a color theme for the text editor component. Must match the file name of a theme in packages/node_modules/@node-red/editor-client/src/vendor/monaco/dist/theme
}
},
mermaid: {
theme: "default" // Select a color theme for the Mermaid diagramming and charting tool. Must match the name of a theme in https://mermaid.npmjs.net.cn/config/theming.html#available-themes
}
},
ui : { path: “mydashboard” },
任何节点类型都可以在文件中定义自己的设置。
functionGlobalContext: { osModule:require('os') }
可以在函数节点中访问,如下所示
var myos = global.get('osModule');
context.global.foo = "bar"; var osModule = context.global.osModule;此方法仍然受支持,但已弃用,转而使用 `global.get`/`global.set` 函数。使用此方法存储的任何数据都不会在重新启动后持久保存,并且在侧边栏上下文查看器中不可见。
true
,则 Function 节点的“设置”选项卡将允许添加其他模块,这些模块将可供函数使用。有关更多信息,请参阅编写函数。默认值:false
。版权所有 OpenJS Foundation 和 Node-RED 贡献者。保留所有权利。OpenJS Foundation 已注册商标并使用商标。有关 OpenJS Foundation 的商标列表,请参阅我们的商标政策和商标列表。OpenJS Foundation 商标列表中未标明的商标和徽标是其各自持有者的商标™ 或注册® 商标。使用它们不意味着与它们有任何关联或认可。
OpenJS Foundation | 使用条款 | 隐私政策 | OpenJS Foundation 章程 | 商标政策 | 商标列表 | Cookie 政策