Description
Currently, these two watchers are intertwined into the same code.
It turns out, the state
is only really touched inside reconfigure()
and passed once to the state diffing function.
This can probably be delegated to a separate package to facilitate easier testing.
It also gave me a new idea: configuration providers (more abstractions, yay!)
Currently, to both use and test pico, you need at least two Git repositories. One for config and one target. I was thinking an abstraction would be nice for testing but it also might be useful for very simple use-cases too.
You might not want your configuration to be tracked in Git. You might just want a simple process that hits 1 or 2 Git repos to run commands and that's it. So, I think abstracting a configuration provider could be beneficial for both these uses.
This might be tricky, but I think using another event bus will make it simpler. I really need to move to using message-bus but that can come later.
This way, the watcher then just receives state on an event, restarts itself and continues.