Programatically change settings.json

Hi, I am developing my own stuff just for fun testing at home as a passion project. I’m using my own application and I wanted to add a button to the application that emulates the “Update receiver parameters” on the web UI.

My understanding is that the pi hosts a nodejs server and then periodically reads the settings.json which is on there, and that settings.json is edited via webui. I can read it but I cannot figure out how to edit it programmatically via html request.

I saw in the readme there was some mention of

curl -F “path=@settings.json” http://KRAKEN_IP:8081/upload\?path\=/

but this path, or anything similar, does not exist. Anyone have experience with this?

I’m not sure if it’s possible to edit it directly via HTML requests. In all software we use we write to it on the system directly.

Sorry, meant http, not that I think it changes your answer. Can you elaborate by what you mean when you say write it on the system directly?

When I click the update receiver parameters on the :8080 UI what exactly is going on under the hood? Also, is the documentation wrong w.r.t this upload path then?

Sorry could you point me to the page where it mentions the curl command? That could be a note provided by another user, as I am not familiar with it.

When you click update the software is internally updating it’s variables. But it also constantly scans the settings.json file for any changes. If there are any changes, it will apply those changes internally.

By on the system, I mean that any software on the system (like the software to connect to the external cloud DoA service) directly opens and writes to the settings.json file and communicates to the with the cloud service via some other interface like secure TCP.

Under the ‘remote control’ section:

The settings.json file that contains most of the DoA DSP settings is served via HTTP and can be accessed via http://KRAKEN_IP:8081/settings.json. Not only the client can download it on the remote machine, but also upload settings.json to the host that runs DSP software via, e.g.,

curl -F “path=@settings.json” http://KRAKEN_IP:8081/upload\?path\=/

The DSP software would then notice the settings changes and apply them automatically.

Ah yes, you can upload a locally stored settings.json to the KrakenSDR using the curl command. So you need to have a settings.json file in the local directory where you are running that command.

I noticed that when I am updating (krakensdr_doa/krakensdr_doa/_share/) settings.json sometimes, be it manually or via my own implemented endpoint, if I visit the 8080/config UI after, all fields are blank - and this may just be anecdotal/small sample size, but it also seems like the Kraken ceases to function. I can see in logs/node.js “hashes not the same, file changed locally”.

I am fairly certain my inputs are sanitized and as expected by the json (the only difference may be the lack of a trailing “.0” in VFO-0 frequencies). Is there some other settings.json I should be amending, or is there some special way I should go about editing it?

How are you updating settings.json? via the curl command?

The code will crash if it reads a bad settings.json

Just in place nano/vi.