mblackstock / node-red-contrib-influxdb

Node-RED nodes to save and query data from an influxdb time series database
Other
64 stars 44 forks source link

Freature request: Load api-token automatically on provisioning of NodeRed flow. #140

Open KvE-DGS opened 10 months ago

KvE-DGS commented 10 months ago

It is not prossible to give the "InfluxDB out node" of this library a pre-shared api-token.

When InfluxDB boots it can load a token from an .env file but this is not prossible in the "InfluxDB out node" when setting up a server.

I have also tried to add an extra field to the JSON description of my flow to be able to set the api-token on load of this flow description, but this field is cleared every time the server connection is booted for the first time.

mblackstock commented 8 months ago

The node is storing and retrieving credentials like other nodes as described here.

I haven't tested yet, but environment variables should be able to be used in credentials properties as described in the user docs, so if you have a variable such as INFLUXDB_API_TOKEN if you put ${INFLUXDB_API_TOKEN} in that field, it should use it. This is similar to MQTT password as described here. Let me know if this works.

taketable commented 7 months ago

I had a similar problem. The environment variable solution works perfectly, even if the flows_cred.json is encrypted.