Open c-nv-s opened 2 years ago
It does not currently, but it could.
It looks like the "watch" functionality on the remote providers doesn't really leverage any of the push-based dynamic updates. Viper instructs you to setup a separate goroutine on a timer that polls the remote source for an update regularly.
It would be fairly trivial to set-up this timer within the pit-of-vipers code, check the remote for an update, and merge it in using the exact same code used to merge in updates from the fs.
I'll try adding this in within the next few days.
If you'd like to test out this PR, it should add support for remote config watching through a new constructor: https://github.com/ajpauwels/pit-of-vipers/pull/3
I've intentionally not broken the existing API to make this a minor version bump, the next major version will replace the existing constrictor with the new style.
If you could test that'd be great as I don't currently have access to a remote store.
thanks a lot, It'll have to be ~mid-next week because I've got a deadline and some things to sort before I can test it but I'll report back asap
no problem, hope pit-of-vipers is able to help you out :)
finally got around to trying to test this out, however I can't seem to get it working.
couldn't find a way to properly pass the viperpit.Config{} as the struct values seem to be unexported ? so even using viperpit.Config{true, 30} you see the message:
implicit assignment of unexported field 'watchRemote' in config.Config literal
could this also support viper instances that also use github.com/spf13/viper/remote which calls the AddRemoteProvider() function ? e.g. https://madflojo.medium.com/using-viper-with-consul-to-configure-golang-applications-eaa84394b8de