Open trajche opened 6 months ago
Hi @trajche, this indeed needs to be looked into and I was able to successfully replicate the issue with the steps that you provided. That being said, I believe that the documentation can be improved as well.
In the documentation, it is not specified what kind of environment variables are in question. As of now, every environment variable reference refers to a system environment variable . In addition to system environment variables, there are process environment variables. These nodes are fully compatible with process environment variables, but the syntax differs from the system environment variables.
Process environment variables are environment variables which are created for the Node-RED process. This is plausible by utilising the function node
. First, the process module needs to be imported:
And then in the code block, the following code can be used to set process environment variable:
process.env.s3_apikey = "test";
Finally, the process environment variable can be referenced as ${s3_apikey}
in an input field, like in the following example:
$
, and the variable name enclosed in parentheses ()
, and for process environment variables, the variable enclosure is also prefixed with $
, but the variable name is enclosed in braces {}
In the node description it's claimed that we can use envvars using $(envvar) synthax inside the config value:![image](https://github.com/digitalnodecom/node-red-contrib-generic-s3/assets/2382019/ae0bba00-d418-4a60-bbef-d9430e5be2ee)
I tried to replace hardcoded value with Node-RED environment variables but it's not functioning. Instead, I believe the literal string
$(s3_apikey)
is used as the Key.The error received is
error: "Forbidden: Forbidden"
Note: I've been testing with environment variables that are defined in the flow (not in Node-RED system). You can check them out by double clicking the flow tab and then clicking on Environment Variables: