Skip to content

Opensearch dashboards.pluginconfigdescriptor

Home > opensearch-dashboards > PluginConfigDescriptor

PluginConfigDescriptor interface

Describes a plugin configuration properties.

Signature:

export interface PluginConfigDescriptor<T = any> 

Example

// my_plugin/server/index.ts
import { schema, TypeOf } from '@osd/config-schema';
import { PluginConfigDescriptor } from 'opensearch_dashboards/server';

const configSchema = schema.object({
  secret: schema.string({ defaultValue: 'Only on server' }),
  uiProp: schema.string({ defaultValue: 'Accessible from client' }),
});

type ConfigType = TypeOf<typeof configSchema>;

export const config: PluginConfigDescriptor<ConfigType> = {
  exposeToBrowser: {
    uiProp: true,
  },
  schema: configSchema,
  deprecations: ({ rename, unused }) => [
    rename('securityKey', 'secret'),
    unused('deprecatedProperty'),
  ],
};

Properties

Property Type Description
deprecations? ConfigDeprecationProvider (Optional) Provider for the to apply to the plugin configuration.
exposeToBrowser? { [P in keyof T]?: boolean; } (Optional) List of configuration properties that will be available on the client-side plugin.
schema PluginConfigSchema<T> Schema to use to validate the plugin configuration.PluginConfigSchema