Settings option in web GUI

Started by syrinxtech, February 22, 2016, 04:28:01 PM

syrinxtech

Just a friendly reminder that whatever method of updating the settings.json5 file you use, stick with it!

For example, if you use the "settings" option in the GUI, it will write the contents of all the fields into the settings.json5 file.
If you choose to use nano or vi to edit the file manually, these changes won't be reflected in the GUI the next time you run it.  So, pick either the manual method (nano, vi) or the GUI method.  This will keep you from losing changes or overwriting the entire file with the defaults.


jkarras

If you edit manually just reload the web app to make the changes reflect inside the app.

syrinxtech

@jkarras,

Not sure about your version but I'm running v8.  I have tried this several ways and from what I'm seeing, the web app doesn't read the current values of the variables in the settings.json5 file.  It only knows the values that have been set from within the web app itself.

I just ran this test again to prove it to myself.  I originally edited the settings file manually using vi.  Then I ran the web-based settings option and all of the default values appeared.  I pressed F5 to reload my browser and nothing changed.  I quit the web app and started again and it still didn't bring in the values from the file.  I then changed one variable using the web app and it wrote all of the values contained within the web app, overwriting all of the information I had manually entered.

For this test, I entered all of the information using the web app and wrote it out to the file.  Then, I manually changed one variable using vi.  When I re-ran the web app (both F5 and restarting the web app), the value I changed was not reflected in the web app.

Unless I'm missing something very fundamental, the web app is an "all or nothing" proposition.  You either enter all values and overwrite every  time, or you manually update all the time.

jkarras

Values are only read from disk when the web app is started on the server. If your test was only to close and reopen the browser window this is not enough to cause the application to reread settings from disk. You'll need to login to the server and issue a restart of the node js process.

syrinxtech

@jkarras,

Thanks for the clarification.  For the last test I manually edited the settings file and then used the "restart gateway app" option in the GUI.  When it restarted the new option was there.

So, then I used the GUI to make a change and as soon as I clicked "Save" the change was effective in the file.  But, it didn't appear that the node.js program was reset.  Does that mean that this change isn't really effective until the web process restarts?


jkarras

Edits made on setting page are saved into RAM when save is issued. Settings on disk are only read into RAM at start up.

syrinxtech


Felix

Hoping this makes it a little more clear...

Most settings in the GUI require a restart for them to be effective. For instance the serial port setting and email settings - those are settings used at startup, so changing them has no effect without a restart. We could add extra code to make them effective immediately but a simple restart from the GUI is easy enough for now.