Hi, after read several messages I still have some troubles, could you please help me?
I have never used environment variables before.
Now, in settings.js I've added "env: process.env" just below " functionGlobalContext: {" like this:
functionGlobalContext: { env: process.env
Moreover, following other post and documents I've modifided the module.exports = { section like this:
module.exports = {
process.env.HOSTNAME = require('os').hostname();
process.env.FOO = 'just another bar';
but in this way it doesn't work. In order to make it works I had to write it as following:
module.exports = {
test1: process.env.HOSTNAME = require('os').hostname();
test2: process.env.FOO = 'just another bar';
I don't know if it's correct but is the only way I was able to make it working.
So, in this way I can use the environment variables set inside the settings.js file.
But I have 2 more needs:
- I would have the environment variables writes in an external file rather than inside settings.js. How can I do this?
- I would even pass as variables users and passwords, for nodes that requires connection like mysql, mqtt, etc.
Briefly, since I have the some project for several users, I would like to have jast one file where to make these changing and let it read and passed to the flow at load, when node-red starts.
Thanks