node.js - 如何移动 Node-Red 项目
问题描述
我有一个运行良好的节点红色项目。我备份了 .node-red 文件夹,现在在同一台计算机上重新安装了 ubuntu 和 node-red。我正在使用 node-red-contrib-postgrestor 节点来访问 PostgreSQL。安装所有必需的节点并将 flow.json 和 settings.js 文件复制到 .node-red 文件夹后,我无法获取使用 PostgresSQL 数据库进行身份验证的流程。我已经编辑了节点属性并重新输入了用户名/密码信息并重新部署。我尝试将 settings.js 文件中的 credentialSecret 属性更改为新的秘密字符串,并且我尝试将属性更改为 false。flow_cred.json 文件是:(1) 未创建,(2) 它是使用内容“{}”创建的,或者 (3) 它是使用加密数据创建的。在任何情况下,我都无法让节点通过数据库进行身份验证。我尝试将调试语句放在 postgrestor.js 文件中,它显示用户名和密码是“未定义的”。
function PostgrestorNode(config) {
const node = this;
RED.nodes.createNode(node, config);
node.topic = config.topic;
node.config = RED.nodes.getNode(config.postgresDB);
node.on('input', (msg) => {
node.warn(`user: ${node.config.user}, password: ${node.config.password}`);
const query = mustache.render(config.query, {msg});
const pool = new Pool({
user: node.config.user,
password: node.config.password,
host: node.config.host,
port: node.config.port,
database: node.config.database,
ssl: node.config.ssl,
max: node.config.max,
min: node.config.min,
idleTimeoutMillis: node.config.idle
});
最初 node-red 程序在 Ubuntu 16.04 中运行。问题发生时我升级到 18.04。我已经回去并重新安装了 16.04,认为这是问题所在,但现在这两种方式都不起作用。
我已阅读以下内容:
https://github.com/node-red/node-red/wiki/Design%3A-Encryption-of-credentials
最后一句“请注意,一旦设置了 credentialSecret,就无法更改其值。” 也许是我的问题,但肯定有一种方法可以更改数据库的登录凭据。
任何想法将不胜感激。
我现在发现 node-red-contrib-postgres 节点没有遇到与数据库的连接问题。node-red-contrib-postgrestor 节点一定存在特定问题。
解决方案
推荐阅读
- c# - 如何删除实体框架中的多个级联路径
- asp.net-identity - Blazor WebAssembly 中定义的登录页面在哪里?
- python - 遍历列表并在 Python 中找到匹配项
- tensorflow - Keras 检查点未保存到谷歌云存储桶
- hsqldb - 升级后 HSQLDB 命令行关闭不再起作用
- javascript - 在反应中更改循环内的especify css元素
- flutter - 在 Flutter 中将带有图像的对象本地存储在磁盘上的最佳方法?
- r - 如何通过 R 中的 dplyr 逐行选择 tibble 中的随机元素?
- java - Unicode ICU 而不是 java.time.DateTimeFormatter 应该用于国际日期和时间
- javascript - React 不更新状态的问题(钩子)