aloneguid / config

⚙ Config.Net - the easiest configuration framework for .NET developers. No BS.
MIT License
656 stars 86 forks source link

Write json config file back to disk as atomically as possible #108

Closed tbraun-hk closed 3 years ago

tbraun-hk commented 4 years ago

Our application using Config.NET to read and update JSON config files is running on systems that might suddenly loose power and do not have a chance of properly shutting down. We repeatedly had the issue of json config beeing empty after such a hard shut down. With this pull request, I'd like to suggest an improvement in writing back json config files. I hope that by forcing a write to disk and (nearly) atomically replacing the json file with an updated version, even in case of sudden power failure the file would never end up empty.

aloneguid commented 4 years ago

@tbraun-hk apologies for the late reply, could you update the PR to latest master please?

tbraun-hk commented 4 years ago

Hi @aloneguid! Thank you very much for your feedback! I hope that I just merged the latest changes from your master branch into this PR correctly. Please let me know if there's anything else I can do to help you merge my PR. Best regards, Tobias