4 ms·
I've done something pretty ridiculous to solve this problem and I'm not sure I'd recommend it, but here it is: - A directory is synced with the server with no
by franga2000 5y ago
I've done something pretty ridiculous to solve this problem and I'm not sure I'd recommend it, but here it is:
- A directory is synced with the server with no conflict resolution
- The application creates its config file in that directory, named by a random UUID, which is stored outside the synced folder
- The config file stores the setting overrides (defaults were compiled-in) in any format (I used YAML)
- Each setting override includes a "locked" and "lastModifed"
- On startup (sync was external) all files in the directory are read and merged starting with the local one, then skipping any settings that are locked (locally or remotely), last modified wins
Some deployments used a daily rsync cronjob, some had a mounted network share (with hilarious broken file locking) and of course it worked with direct bind mounts as well.
I also briefly experimented turning the "locked" field into a "group" field to enable multiple "sync groups" with some keys shared globally and some only with other group members (even different groups for different settings), but it ended up not being useful for my use case, although it did work.
- nyanpasu64 5y agoSounds interesting. I suppose it would break if a computer's clock was set in the future (its lastModified would always win), but IDK what wouldn't break in that scenario. What does the locked field do? Do you have a link to your implementation, or is this proprietary?