-
Notifications
You must be signed in to change notification settings - Fork 9
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
Fix handling of unmapped configuration options #185
base: develop
Are you sure you want to change the base?
Conversation
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.
Tests seem to be failing.
config/registry.go
Outdated
option.activeValue, vErr = validateValue(option, value) | ||
if vErr != nil { | ||
return fmt.Errorf("config: invalid value: %w", vErr) | ||
} |
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.
Normal config loading just collects the validation errors from loaded config and reports them.
This would prevent the plugin from starting with an invalid config value, if it fails when failing to register the config option.
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.
after discussion: make sure we can return that error to the caller of config.Register()
but not fail the registration
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.
this requires an update to the plugin system to handle that case correctly
One thing that came to my mind, if an option is lazy-registered and the value is poped from the |
eb335ab
to
3ae6368
Compare
63f7a96
to
f67ad49
Compare
This PR fixes a bug in the configuration system that prevents lazily registered config options to receive the current value stored in the configuration file.
Changes:
replaceConfig
) all unmapped/unused values from the configuration file are stored in a globalunmappedValues
map.config.RegisterOption
checks for unmapped values from the above map and immediately sets the value of the new option.unmappedValues
.