-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Implement plugin config prefix #6554
Conversation
- switch from maps to objects - use lodash's get/set/has - use configPrefix instead of id, if set - also adds an unset config method
if (initialVals) { | ||
this.set(key, initialVals); | ||
this[pendingSets].delete(key); | ||
const path = toPath(key); |
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.
path
isn't used here
LGTM |
this[schema] = Joi.object().keys(objKeys).default(); | ||
this[schema] = (function convertToSchema(children) { | ||
let objKeys = Object.keys(children); | ||
let schema = Joi.object().keys(objKeys).default(); |
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.
passing objKeys
here is unnecessary. Joi is itterating the own properties of objKeys
and adding them as keys, but since it's an array it has no own properties and does nothing.
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.
Yup, I read the Joi docs wrong before.
The call to .keys()
is required, otherwise the validation fails (and the tests do as a result), but it just needs to be given an empty object, since the actual keys are appended after the fact.
There appears to be what looks like a race condition here, where the keys in the schema are changing and then the validation fails. I've used this to prefix the XPack settings with
And then Kibana fails due to schema issues: |
also fixes issue with recursive removal of properties
Issue was related to disabled plugins. Should be fixed now. @spalger I broke out the unset module and added tests, let me know if there's a scenario I missed in there though. |
jenkins, test it |
1 similar comment
jenkins, test it |
Closes #6304
Allows plugins to optionally prefix their config values via a new
configPrefix
parameterWhen
configPrefix
is set, it uses that value for the config values. Otherwise it uses the default, which is simply the pluginid
value.Both of these are valid: