Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow matching config validation errors #83

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lippserd
Copy link
Member

@lippserd lippserd commented Oct 24, 2024

Any error returned from Validate() is propagated with ErrInvalidConfiguration attached, allowing errors.Is() checks on the returned errors to recognize both ErrInvalidConfiguration and the original errors returned from Validate().

This will be utilized in Icinga DB to support loading configuration from both YAML files and environment variables. If loading from a YAML file fails, we will check for ErrInvalidConfiguration to proceed with loading the configuration from environment variables, as it may be incomplete and will be revalidated in FromEnv().

@cla-bot cla-bot bot added the cla/signed CLA is signed by all contributors of a PR label Oct 24, 2024
@lippserd lippserd force-pushed the allow-matching-config-validation-errors branch 2 times, most recently from 7e61437 to ae4d57c Compare October 26, 2024 17:51
@lippserd lippserd marked this pull request as ready for review October 26, 2024 18:12
@lippserd lippserd force-pushed the allow-matching-config-validation-errors branch from ae4d57c to 5e07404 Compare October 28, 2024 10:41
Any error returned from `Validate()` is propagated with
`ErrInvalidConfiguration` attached, allowing `errors.Is()` checks on the
returned errors to recognize both `ErrInvalidConfiguration` and the original
errors returned from `Validate()`.
@lippserd
Copy link
Member Author

@oxzi you already approved #87, but I created this PR here first before changing the implementation over at Icinga/icingadb#831.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla/signed CLA is signed by all contributors of a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants