DSPP-450 Use go-viper/mapstructure and validator packages for config parsing#24
Open
ashley-graham wants to merge 7 commits into
Open
DSPP-450 Use go-viper/mapstructure and validator packages for config parsing#24ashley-graham wants to merge 7 commits into
ashley-graham wants to merge 7 commits into
Conversation
|
I don't think it needs to be multiple PRs. Just will take a little bit to look through everything. |
Contributor
Author
Okay, thank you! And absolutely no rush as this was a second seashell thing for me. |
joshuawscott
approved these changes
Jul 6, 2026
cjonesy
approved these changes
Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DSPP-450
Context
This PR replaces repeated manual config parsing from
map[string]interface{}with a with a shared YAML decoding and validation path built on yaml.v3, mapstructure/v2, and validator packages.The config shape stays the same for users:
watcher.typewatcher.configexecutioner.typeexecutioner.configKey Changes
Internally, each watcher and executioner now:
mapstructuretags for field mappingvalidatetags for required fields and value constraintsconfig.DecodeUnknown config fields now fail during load:
gce_metadata.metadata_error_wait_seconds = 10Prioritization for Reviewers
I made some small changes to each of the sources of documentation in this repo. Those files aren't as important for review. I'd say, in order of priority, the changed files are:
internal/goverseer/config/decode.go: Core shared decoder/validator logic.internal/goverseer/config/config.go: Top-level config structs, Viper file loading, and top-level validation tags.internal/goverseer/config/config_test.go: Coverage for the new stricter parsing behavior and shared decode helper.shell_executioner.go,file_watcher.go,gce_metadata_watcher.go,gcp_secrets_watcher.go,time_watcher.go,log_executioner.go)README.md,docs/watchers/*.md,docs/executioners/*.md)If it would be better to put this into five stacked PRs instead of 5 commits, let me know.
Caveat on Commit History
Josh reached out and noted that we're not really getting all the benefits of viper here given our use case. So I've removed viper and instead directly required the mapstructure piece I wanted to keep. The decode.go and config.go were updated accordingly here.