Background
On Linux Node-red can be executed in various ways:sudo systemctl enable nodered
& rebootsudo systemctl [re]start nodered
node-red-start
node-red-pi
node-red
Edit - corrected (swapped 3 & 4), added 5.
1, 2 and 3 will (always - assuming the OS supports systemd?) start Node-red as a systemd service using the script at /lib/systemd/system/nodered.service
In this case, any environment variables specified in a file ~/.node-red/EnvironmentFile
will be inherited by Node-red *
4 and 5 start Node-red directly, not using the systemd script, so the file is not imported.
Note that node-red-start is very widely recommended as the start-up command of choice despite it bypassing this and other advantages of the systemd script file.
*
Or it may be ~/.node-red/environment
, depending on the installer script version first used on that machine.
Problem
The confusingly varied startup behaviour makes it hard to tell if required environment variables have actually been imported.Proposal
**1** Add `dd mmm HH:MM:SS - [info] Environment file : /home/pi/.node-red/EnvironmentFile` to the current information in the Node-red log:22 Jul 15:34:20 - [info] Node-RED version: v4.0.0-beta.4
22 Jul 15:34:20 - [info] Node.js version: v20.15.1
22 Jul 15:34:20 - [info] Linux 6.6.31+rpt-rpi-v8 arm64 LE
22 Jul 15:34:20 - [info] Loading palette nodes
22 Jul 15:34:22 - [info] Dashboard version 3.6.5 started at /ui
22 Jul 15:34:23 - [info] Settings file : /home/pi/.node-red/settings.js
22 Jul 15:34:23 - [info] Context store : 'memoryOnly' [module=memory]
22 Jul 15:34:23 - [info] Context store : 'file' [module=localfilesystem]
22 Jul 15:34:23 - [info] User directory : /home/pi/.node-red
**************** This line
22 Jul 15:34:23 - [info] Environment file : /home/pi/.node-red/EnvironmentFile
****************
22 Jul 15:34:23 - [warn] Projects disabled : editorTheme.projects.enabled=false
22 Jul 15:34:23 - [info] Flows file : /home/pi/.node-red/flows.json
22 Jul 15:34:23 - [info] Server now running at http://127.0.0.1:1880/
2 Bring the script node-red-start into line with the systemd script.