-
Notifications
You must be signed in to change notification settings - Fork 590
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
feat: add Config.Validate() to allow validation of configuration options before starting the manager #3405
Conversation
d475b26
to
fb19dc7
Compare
Codecov ReportBase: 74.0% // Head: 73.8% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #3405 +/- ##
=======================================
- Coverage 74.0% 73.8% -0.3%
=======================================
Files 113 114 +1
Lines 13892 13928 +36
=======================================
- Hits 10291 10287 -4
- Misses 2954 2985 +31
- Partials 647 656 +9
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the direction of making the validation run as soon as possible, not leaving the responsibility to the routines that accept the Config
. It's gonna be less error-prone and will save us from scattering validation code over places that should not be responsible for that.
…ons before starting the manager
e28c3d4
to
03a2cef
Compare
03a2cef
to
82f45e5
Compare
What this PR does / why we need it:
This PR adds
Config.Validate()
to allow validation of configuration options before starting the manager.This will also set the stage to allow stopping the manager boot up process when mutually exclusive options are being provided (e.g. as in single controller deployments
kong-admin-url
and potential future Admin API service name specified for service discovery).Additionally this performs some minor refactor around config and passing down the configuration options to downstream consumers of said options. It also stores the flagset in the
Config
so that we can usec.flagSet.Changed()
to verify if the flag has been provided by the user ( in case the default flag value is a non empty/default value).