Hello, I sometimes wipe my operating system, and setting up Syncthing with all the settings can be a real pain. I wanted to see if it was possible to manage the Syncthing config.xml using git on a per-system basis. There is a tool, Chezmoi, that manages various user configuration files via copying and no symlinks. It also incorporates age encryption, so I’d be able to encrypt the config file on my locally hosted git repository. I’d have a per-device configuration and only edit the config.xml file when I want to make changes. Would this break anything, or would I be able to keep my configuration like this without causing any errors? Is the config.xml file dynamically generated?
I don’t know chezmoi, but for sure you can use an external tool to manage the config.xml.
Chezmoi enforces configuration state based on the files it has in its locally managed git repository. If I add config.xml to chezmoi, it will track any changes made to the file on the system compared to what it manages in its local git repo. When you run chezmoi apply, it will overwrite any local changes on the system so the file matches the state in its git repo.
Does Syncthing automatically modify config.xml during normal operation, such as on startup, or does it strictly only write to the file when a user actively changes a setting via the GUI or API?
Chezmoi allows you to manage unique configurations for every system because of its system fact discovery and Go templates. The downside is that each device downloads the same git repo which contains shared configuration files for all other systems. The solution to this is Chezmoi’s use of age encryption, allowing each file to be encrypted with a different key. This ensures the configuration file can only be decrypted on a per-system basis.