cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

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

m3yco
Member

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

Tags (1)
14 REPLIES 14
schoeffler
Member

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

I have basically the same issue. We need to change the "uiHost" configuration value of NodeRed. The configuration value can be set within the settings.js file. An option to (easily) replace or modify the settings.js would be very helpful to us.

JohannesA
Established Member

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

Hi all,

this feature will be implemented with next release-milestone RM21.07. 

Stay tuned 🙂 

Best regards

Johannes

 

 

jacaré
Established Member

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

is this feature available and where can I find the documentation?

CodeShepherd
Community Moderator

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

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.

Yacine
Established Member

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

Hello, 

 

how could we access to the directory to replace the setting.js file without ssh access ? 

 

Thanks.

CodeShepherd
Community Moderator

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

The first path mentioned above can be accessed via WebDAV. See this post.

Yacine
Established Member

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

Hi, 

 

thanks for your feedack, 

the folder accessible with webdav protocol are not complete, 

so for example,  snaps where we can put the settings.js of Node-red is not reachable 

see below for Node-red from webdav

Yacine_0-1663578131790.png

 

CodeShepherd
Community Moderator

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

Sorry for the confusion. The app itself has a direct link to the folder in the app data (activeConfiguration) and the path you can access with WebDAV is linked to the same folder in the file system. WebDAV is limited to only this app data (activeConfiguration) folder and cannot access any other path in the system.

Yacine
Established Member

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

that means that to insert setting.js file of node-red, we have to use ssh ? 

CodeShepherd
Community Moderator

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

No, you do not need ssh. You can use WebDAV and put it to the active configuration (settings.js and data). The app itself can also access to this path.

See this thread for how to write files in Node-RED. Reading is working just the same.

Yacine
Established Member

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

Hello, 

we tried to load the setting.js file using webDav, but we were not able to load it , see screen.

thanks.

 

Yacine_0-1664368249801.png

 

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

Thanks Yacine,

Here the Files, for someone who want to test.

You have to install this dependance in NR : https://flows.nodered.org/node/node-red-contrib-fs-ops

You have to change the extention file txt --> json.

Regards.

 

 

 

Tags (2)
Open
Established Member

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

Hello,

I am new to settings.js in node-red, 

I am unable to find settings.js node-red file using WinSCP connection to my ctrlX. Do i have to generate the settings.js file? or i have to have a default settings.js file and copy paste into the ctrlX node-red appdata file directory?

Open_0-1665363807535.png

 

Tags (2)
CodeShepherd
Community Moderator

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

In my post above I mentioned the paths where the settings.js file is expected. After installation it is only in the installation path available and can be put to the active configuration to be "replaced".

Also as mentioned above: 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.

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist