syncthing / syncthing/syncthing
Config cleanup: attributes vs elements
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 88.8k
- Forks
- 5.5k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 5
Description
In the XML format config, folders and devices have some settings as attributes and some as child elements. This is somewhat arbitrary, originally maybe based on what felt like "important" or "small" config settings perhaps. I suggest straightening this out by moving all attributes except id into elements. That is, a folder like:
<folder id="test" path="testdata" type="readonly" ignorePerms="false" rescanIntervalS="600" autoNormalize="true">
<filesystemType>basic</filesystemType>
would become:
<folder id="test">
<filesystemType>basic</filesystemType>
<path>testdata</path>
<type>readonly</type>
<ignorePerms>false</ignorePerms>
....
(Correspondingly for devices)
We would need to support reading the values as attributes as well as elements for a while. Wrappers who generate our config format would still be able to do so and we would understand the old format.
Wrappers who read our XML format would need updating, though the only reason for doing so I can think of immediately is to find out the API port and key, which would be unaffected by this. Other config manipulation should ideally happen through the API which is not affected by this. (Ideally the tls and debugging attributes on gui should also become elements, but I'm not super adamant on that change.)
Making this change supports solving #4224 nicer in the future, as we can then declare default objects with only elements in them, corresponding precisely to device and folder objects.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the XML configuration handling for folder and device attributes and elements; no specific file or test is named in the issue. Trace how existing attributes are read and how configuration is written, including backward-compatible parsing. Done means non-id attributes are represented as elements while old attribute-based configurations remain readable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100