🐛 load flags via viper/cnquery providers #1508
Merged
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.
Holy 🐮 cow! Are you ready for this fix!??
Based of mondoohq/cnquery#4863 where we now properly load provider flags via
viper
and from environment variables, we depend of the viper binding of such flags and, sincecnspec
did not have aPreRun()
function but aPreRunE()
, we did not load them.This simple change fixes that issue, we now load the flags since we have the
PreRun()
function that is required to bind our flags at https://github.com/mondoohq/cnquery/blob/main/cli/providers/providers.go#L378-L399This code is very similar to the code in
cnquery
at:https://github.com/mondoohq/cnquery/blob/main/apps/cnquery/cmd/scan.go#L88