node-red-节点凭证 [英] node-red - Node Credentials

查看:309
本文介绍了node-red-节点凭证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个红色节点流中,我有一个CassandraDatabase节点,其中有一个用户并通过。当我导出流时,这些凭据未包含在json中,而是出现了带有加密字符串的flows_cred.json文件:

Within a node-red flow I have a CassandraDatabase node with a user and pass. When I export the flow these credentials are not contained in the json, instead a flows_cred.json file appears with an encrypted string:

{ $: df28 .. .....

{"$": "df28.......

...但是,如果我复制此文件并尝试在其他地方启动节点红色实例,则在启动时会得到以下信息:

... however if I copy this file out and try to bring up my node-red instance elsewhere I get the following at startup:

[警告]加载凭据时出错:SyntaxError:JSON中位置0的意外标记�

[warn] Error loading credentials: SyntaxError: Unexpected token � in JSON at position 0

...紧接着是重复的 AuthenticationError:未设置身份验证提供程序消息。确实,凭据没有被节点红色流获取,因此我必须再次手动输入。

... followed by a repeating "AuthenticationError: Authentication provider not set", message. Indeed the credentials have not been picked up by the node-red flow and so I must input manually again.

有人知道允许我成功导出凭据的诀窍吗?

Anyone know the trick to allowing me to export the credentials successfully?

推荐答案

凭据文件(默认情况下,flows_cred.json )是加密的,以确保其内容不易读取。

The credentials file (flows_cred.json) is encrypted by default to ensure its contents cannot be easily read.

如果发生以下情况,Node-RED会生成随机密钥您不提供一个ettings文件。如果第二个Node-RED实例没有相同的加密密钥,则它将无法解密该文件。

Node-RED generates a random key for the encryption if you do not provide one in your settings file. If the second instance of Node-RED doesn't have the same encryption key, it won't be able to decrypt the file.

这是您需要执行的步骤解决这个问题。

Here are the steps you need to resolve this.


  1. 编辑您的 settings.js 文件并添加一个具有任意字符串值的 credentialSecret 属性。如果要禁用加密,请将其值设置为 false

  1. edit your settings.js file and add a credentialSecret property with a whatever string value you want. If you want to disable encryption, set its value to false.

credentialSecret: "my-random-string"


  • 重新启动Node-RED并部署更改-这将触发Node-RED使用您选择的密钥重新加密您的凭据(如果设置为false,则禁用加密)。

  • Restart Node-RED and deploy a change - this will trigger Node-RED to re-encrypt your credentials with your chosen key (or disabling encryption if set to false).

    然后,您可以复制流/ credential文件到第二个实例,只需确保在其设置文件中为其赋予相同的 credentialSecret 值即可。

    You can then copy your flow/credential file to a second instance, just make sure you give it the same credentialSecret value in its settings file.

    请注意,一旦设置 credentialSecret ,就无法更改其值。

    Note that once you set credentialSecret you cannot change its value.

    这篇关于node-red-节点凭证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆