Open
Description
Preflight Checklist
- I have searched the issue tracker for an issue that matches the one I want to file, without success.
Problem Description
I'd like to be able to stop the file watcher created by calling Viper.WatchFile()
. Being able to gracefully tear down the filewatcher helps to ensure a clean shutdown without possible invocations of the onConfigChange
function.
Proposed Solution
Add a Golang context and cancel-function to the Viper
struct type. Move the events waitgroup (eventsWG
) from the watcher go-routine to the Viper struct type. Initialize these fields in the WatchConfig()
function. Add a Viper.Stop()
function that calls the cancel function to stop the watcher.
Alternatives Considered
No response
Additional Information
No response
Activity