Hi. My NR system is growing, so I decide to split functionality into many separate NR instances. I want extract some settings from existing flows, like mqtt server adress, device/service (NR instance) name and so on.
The mqtt server parameters are easy to handle, as set the env variable in settings.js - which is common to each NR instance. But I can't figure it out, how to pass instance name to NR instance, which I could use then in MQTT will topic for example.
Is there any option to pass some parameters (env variables?) to NR instance? I'm not using docker.
Set them as real (not in settings.js) environment varariable that are in scope before you start each instance.
How you actually set them depends on what OS you are running on
Oh thank You. Just searched the Internet for scoped environment variables and found this:
env VAR1="value" command_to_run command_options
and for Windows (my current case):
cmd /c "(set VAR1=value && command_to_run command_options)"
Note that, my goal was to call NR in one line, without batch file, and without the current environment being affected by seting new env variables. This variables should be visible only in that context, so I have to call new
cmd /c to nest the command shell and then chain
&&. Important thing are the parentheses
( ) which groups or nest multiple commands. Without these the node-red can't see previously set variables.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.