I'm making a Kibana plugin, and I want to use the config built into Kibana instead of trying to handle things downstream in my plugin. My intention is to be able to set a few variables, and have them persist across reboots, and across clustered kibana instances. Here's how I'm doing it.
// myPlugin's index.js
return new kibana.Plugin({
// skipping for brevity
config(Joi) {
return Joi.object({
enabled: Joi.boolean().default(true),
gcpStorageKey: Joi.string().optional(),
}).default();
},
// skipping more
}
Later, I'm setting my config by doing:
const setKey = (key: string): void => {
const conf = server.config(); // *server* defined elsewhere in file
conf.set('myPlugin.gcpStorageKey', key);
}
Later later, reading it with:
const init = (): void => {
const conf = server.config();
const key = conf.get('myPlugin.gcpStorageKey'); // <- works just fine, unless I restart kibana
// ... using the key
}
Is the server.config()
supposed to persist changes to the config? Is this only happening because I'm using the development server, and not the permanent one?
Thanks for the help.