3 ms·
viper, which nicely handles env vars, also can watch for config changes: https://github.com/spf13/viper#watching-and-re-reading-config-files https://github.com/
by maximente 5y ago
viper, which nicely handles env vars, also can watch for config changes: https://github.com/spf13/viper#watching-and-re-reading-config-files https://github.com/spf13/viper#watching-and-re-reading-confi...
if you're rotating creds or need to open/close the DB, this will typically just add another select case to your main method, where you also block on e.g. signal catching to cleanly shutdown the app
- snupples 5y agoBe aware that viper isn't thread safe. You'd still have to copy config by value and then put a mutex on that, then handle reads and writes separately. https://github.com/spf13/viper#is-it-safe-to-concurrently-read-and-write-to-a-viper https://github.com/spf13/viper#is-it-safe-to-concurrently-re...