Option to replace the Settings.js file from the NodeRed snap

Hallo ctrlX CORE team,

the Settings.js file has many setting options that could be helpful for the development of NodeRed, for example:

  • mqttReconnectTime
  • definition an implementation of global context Function
  • set enviroment variables for configs
  • context Storage parameters to store data globally or persistently in a file
  • to declare own logging levels

After the app installation, this file is in the same root / nodered folder structure as the flows.json is located.

My question is could you not make this file replaceable? In the past, this was possible with the pre-series devices.

I have attached a Settings.js file as an example.

Thank you for your efforts and keep up the good work

 

With best regards

m3yco

Best reply by CodeShepherd

At the moment this info is missing in the documentation. But while booting up the Node-RED snap is looking to following paths in the mentioned order if there is a settings.js ($SNAP_DATA = /var/snap/ctrlx-node-red/current):

  1. $SNAP_DATA/solutions/activeConfiguration/node-RED/settings.js
  2. $SNAP_DATA/settings.js
  3. /snap/ctrlx-node-red/current/settings.js

If you like to change settings you should copy out an original Settings.js already prepared by us for normal usage (otherwise the snap will/could stop working) from the third path, then add your extensions and load it to e.g. the first path to be persistent.

Important notes:

  • Changes in the Settings.js file can have unexpected effects (like crashing the app) and will be done on your own risk.
  • Getting the original file can only be done with a root user at the moment.
  • Beware that the original file probably gets updated in later version of the app so you also will have to adapt your own .js file.

View original
settings.zip
4.43KB
1
14 replies