I like to use a os variable in my flow, the hostname.
So i added a line in (top) of settings.js
(Nodered is installed as a docker container on a rpi 4b, with the latest image/container of NR)
process.env.hostname = require('os').hostname();
in my flow i use
var theHost = global.get('env').hostname();
msg.payload = theHost;
and get: TypeError: Cannot read property 'hostname' of undefined
I also tried
var theHost = global.get('env');
msg.payload = theHost.hostname;