is impossible to set an environment variable username, password in node-red-contrib-mssql-plus ??
I tried {{username}} and {{{username}}} but it didn't work
is impossible to set an environment variable username, password in node-red-contrib-mssql-plus ??
I tried {{username}} and {{{username}}} but it didn't work
Are you certain the node environment has picked up those variables. A quick test would be to run an exec node and call set or export depending on your operating system & see if the env var is present - or use an inject (set payload to env username
) then to debug node.
Additionally, environment variables in node red are only applied on startup, so if you have just adjusted the MSSQL config node. Then it won't pick up the environment variable until it is restarted.
username
actually has a value inside node-red?
Works for me.
What OS are you on?
Do you see the ENV VAR if you run this...
[{"id":"67000189.da769","type":"inject","z":"7741f79c9d2c194c","name":"Linux","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1330,"y":440,"wires":[["7e0062b2.c73adc"]]},{"id":"7e0062b2.c73adc","type":"exec","z":"7741f79c9d2c194c","command":"DISPLAY=:0 printenv","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":1538,"y":440,"wires":[["bd65cfa7.0626a"],[],[]]},{"id":"bd65cfa7.0626a","type":"function","z":"7741f79c9d2c194c","name":"","func":"var lines = msg.payload.split(\"\\n\")\nvar envvars = {};\nfor(let i = 0; i < lines.length; i++) {\n let line = lines[i];\n let parts = line.split(\"=\");\n envvars[parts[0]]=(parts[1]||\"\").trim();\n}\nmsg.payload = envvars;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1740,"y":460,"wires":[["36b59d59.44c5a2"]]},{"id":"36b59d59.44c5a2","type":"debug","z":"7741f79c9d2c194c","name":"Env Vars","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1740,"y":520,"wires":[]},{"id":"4490197a71c2ebe2","type":"inject","z":"7741f79c9d2c194c","name":"Windows","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1340,"y":500,"wires":[["8c2f83bf0c544107"]]},{"id":"8c2f83bf0c544107","type":"exec","z":"7741f79c9d2c194c","command":"set","addpay":false,"append":"","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"","x":1490,"y":500,"wires":[["bd65cfa7.0626a"],[],[]]}]
thank you the problem is solved, I had a problem related to the Docker configuration
Always wise to mention if you are using docker (hint: it's usually somehow related to the problem )
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.