# Settings.js will be ignored

Hello,

I'm using Ubuntu Core on a Raspberry Pi and also on a DELL Edge Gateway. On both systems Node-red is installed (snap). During the start/run of Node-red the used settings.js file is displayed (root/snap/node-red/current/settings.js). Changes at this file and also in the settings.js (/home/{user}/snap/node-red/current) has no effect after restart. Any suggestions what the reason can be? Thanks a lot.

BR, Dirk

I imagine that NR is not actually using the settings file you think it is.

Normally you would try turning up the logging to see what is happening, not sure if there is a command line switch to do that since you can't change the settings.

Alternatively, maybe you can find a file monitor that will show you which files are being opened by NR.

1 Like

I agree with TotallyInformation. I had the same problem. You can specify the settings file to use when starting node-red by using the command node-red -s path\to\settings\file

This is under snap - so yes - I can't recall which settings it uses - but it is pretty "secure" in that it doesn't like things to get access where they shouldn't. I know it will certainly revert things to vanilla if you update at all.

Thanks, but my ubuntu core said flag "-s" is unknown

That is very confusting, I have absolutely no idea what is going wrong. What command do you use to start node-red?

I use "snap start node-red" or "snap run node-red"

what happens if you try snap start node-red -s path\to\settings\file.js?

unknown flag "-s"

This is a snap issue rather than Node-RED as such.

What does the snap documentation say about passing parameters to an executable?

The only way I found to do this so far was to change the exec line of the snap desktop file in /var/lib/snapd/desktop/applications. Unless the exec line contains an environment variable in the exec line that is. I haven't installed the node red snap so I don't know whether this is the case. I have asked on the Ubuntu list whether there is another way.
@dirkzp find the desktop file in the directory mentioned and post the contents here so we can have a look.

happy to take a Pull Request if someone figures it out.

Is the snap desktop file under our control? If so then you could possibly add an environment variable to the exec line so one should be able to say something like
NODE_RED_PARAMS="-s some/file/path" snap start node-red

the command it uses is
"$SNAP"/bin/node-red -u "$SNAP_USER_DATA" "$SNAP_USER_DATA/flows.json" so what is$SNAP_USER_DATA set to ? as that is where the settings file and flows file should be .

The content of the file under /var/lib/snapd/desktop/application is:

[Desktop Entry]
X-SnapInstanceName=node-red
Type=Application
Name=Node-RED
Comment=Flow-based programming for the Internet of Things
Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/node-red_node-red.desktop /snap/bin/node-red.desktop-launch
Icon=/snap/node-red/314/meta/gui/node-red.png
Terminal=false
Categories=Development;

Out of interest, where does that get invoked from? I was expecting to see it in the desktop file.

So, what is your opinion? What should I add to the file under applications?

@dceejay: Do you have a suggestion? at the moment I can't use node-red under Ubuntu Core because of ignoring the settings.js file. Especially to change the credentials or add an additional node directory. Thanks fr your help.

Hi, sorry I'm on a business trip for next two weeks so can't dig into this now. It will be using a settings file somewhere.

If you can run command-line in snap, you could find out what file Node-RED is trying to access when it opens. I know there are linux tools for that though my sysadmin-fu is not quite up to the job of telling you what they are I'm afraid.