Minimum xml tags for folders and devices

In the “Syncthing Configuration” documentation page, there are only a few attributes that are marked “mandatory” for the folder element (id, path) and the device element (id, address). Does that mean I can create the config.xml file from scratch and safely omit all the elements not marked “Mandatory?” Will syncthing then use the default attribute values defined in the “defaults” element (in its “folder” and “device” child elements)?

The reason I ask is that I am trying to setup syncthing programatically (in ansible) from scratch, on a new system. So I cannot copy/paste/edit manually, or click things in the GUI.

Basically, I am looking to set e.g. a folder element that looks like this:

<folder id="Documents" path="/home/user2/Documents/">
  <device id="some-device-id-string">

As long as the XML syntax is valid, it’s not even necessary to include the mandatory fields because Syncthing automatically “fills in the blanks” as needed.

For example, at work I have a cluster of servers. To simplify scripting, I use the same API key for each node. I also preset the UI theme and a few other custom settings.

When Syncthing starts up, it sees nothing else but a partial config.xml under ~/.config/syncthing. Syncthing loads the existing (incomplete) configuration and adds all of the mandatory bits.

Great, that’s just what I was hoping for. Thanks for this information.

Only caveat is it doesn’t apply the folder and device defaults elements at this point (I think, haven’t checked). Rather the instances are populated with hard-coded default values. If you want to apply default values in this way, add the folders / devices via the API or include any necessary customizations in your generated XML snippets directly.

OK, good to know, thanks. I’ll plan on supplying values for the elements I care about then.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.