syncthing: add guiAddress to configuration (#7281)
We have a configuration option services.syncthing.guiAddress which is an explicit option because we need it in the syncthing-init service, but why not also set it in the actual syncthing config as well as (or instead of?) the current CLI override? This way other software that parses the config file / REST API like syncthingtray just works with it instead of erroring out and unexpectedly requesting user interaction. I guess we could actually also scrap the explicit services.syncthing.guiAddress option in favor of the syncthing-native services.syncthing.settings.gui.address because these two (valid!) options conflict otherwise. Also, a next PR (or addition to this one) could be to make sure the syncthing-init service treats services.syncthing.settings.gui differently by not PUTting but PATCHing the configuration as PUTting triggers an API key regeneration, again breaking REST API access for other tools.
This commit is contained in:
parent
a4f9ab0005
commit
3faf4a1507
1 changed files with 3 additions and 0 deletions
|
|
@ -199,6 +199,9 @@ let
|
|||
syncthing_password=$(${cat} ${cfg.passwordFile})
|
||||
curl -X PATCH -d '{"password": "'$syncthing_password'"}' ${curlAddressArgs "/rest/config/gui"}
|
||||
''
|
||||
+ lib.optionalString (cfg.guiAddress != null) ''
|
||||
curl -X PATCH -d '{"address": "'${cfg.guiAddress}'"}' ${curlAddressArgs "/rest/config/gui"}
|
||||
''
|
||||
+ ''
|
||||
# restart Syncthing if required
|
||||
if curl ${curlAddressArgs "/rest/config/restart-required"} |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue