In my project, each device has several unique properties such as serial_number and owner_id. Every time I setup a new device for my customer, I need to manually set the env vars for the flow by double clicking the flow tab and put the key-value pairs in.
I have a development machine which will push changes and all the devices will only pull from the repo. However, every time I pull the code, the env vars will be overwritten, I have to manually set the vars for each single device.
It has a very bad scalability if there are thousands of devices, it is impossible to manually setup the env vars every time I need to update the code.
In the systemd script you can include a file containing env vars, which you could modify for each system. As @jbudd says the pi/debian/ubuntu install script does this for you. The systemd script includes the line EnvironmentFile=-/home/colinl/.node-red/environment
so you could do something similar in your script. The - before the path tells systemd not to error out if the file does not exist.