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

Plugins can declare disability be default #49289

Closed
mshustov opened this issue Oct 25, 2019 · 2 comments · Fixed by #50286
Closed

Plugins can declare disability be default #49289

mshustov opened this issue Oct 25, 2019 · 2 comments · Fixed by #50286
Assignees
Labels
blocker Feature:New Platform NeededFor:Endpoint Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Team:Defend Workflows “EDR Workflows” sub-team of Security Solution Team:Endpoint Response Endpoint Response Team

Comments

@mshustov
Copy link
Contributor

Original message from @FrankHassanabad

In the legacy platform we have a isEnabled function
isEnabled(config: Legacy.KibanaConfig) {
where we define our plugin and we can use that if we want to hide our plugin behind a feature flag during development such as actions and alerting is doing at the moment.
In the new platform it looks like we have a cool automatic feature where we don't need to define an isEnabled function but rather the new platform just uses our id from kibana.json automatically:
https://github.com/elastic/kibana/blob/master/src/core/server/config/config_service.ts#L104
And if we want to disable a plugin we put our id from kibana.json inside of our kibana.yml with enabled set to false if we want to turn off that plugin.
For example:
inspector.enabled: false
However, how do we flip the logic within a new platform plugin to disable our plugin by default unless some one enables explicitly to true within kibana.yml to replicate the same feature flag behaviors we have been using in plugins such as actions and alerting?

Proposed solution

I'd expect that plugins can specify a default value for enable flag during schema declaration

export const config = {
  schema: schema.object({
    enabled: schema.boolean({ defaultValue: false })
  })
}

It turned out that platform ignores those default values and uses raw config instead https://github.com/restrry/kibana/blob/841abd1162f1eb6aaebf27d004c92e8344636d91/src/core/server/config/config_service.ts#L108
At this stage we already have plugins validated config and can access enabled value.https://github.com/restrry/kibana/blob/841abd1162f1eb6aaebf27d004c92e8344636d91/src/core/server/plugins/plugins_service.ts#L146-L150

const isEnabled = validatedConfig ? validatedConfig.enabled : config.get(enabledPath);
@mshustov mshustov added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Feature:New Platform labels Oct 25, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-platform (Team:Platform)

@spong
Copy link
Member

spong commented Oct 29, 2019

@joshdover -- I wasn't able to get an exact timeframe, but looks like they're planning to merge into master for 7.6. Will post additional details if I hear back with something more specific.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker Feature:New Platform NeededFor:Endpoint Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Team:Defend Workflows “EDR Workflows” sub-team of Security Solution Team:Endpoint Response Endpoint Response Team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants