{"modulePath":"github.com/Mattermost/platform","version":"v4.10.9+incompatible","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package pluginenv\n\nPackage pluginenv provides high level functionality for discovering and launching plugins.\n\n## Functions\n\n```go\nfunc DefaultSupervisorProvider(bundle *model.BundleInfo) (plugin.Supervisor, error)\n```\nDefaultSupervisorProvider chooses a supervisor based on the system and the plugin's manifest contents. E.g. if the manifest specifies a backend executable, it will be given an rpcplugin.Supervisor.\n\n```go\nfunc ScanSearchPath(path string) ([]*model.BundleInfo, error)\n```\nPerforms a full scan of the given path.\n\nThis function will return info for all subdirectories that appear to be plugins (i.e. all subdirectories containing plugin manifest files, regardless of whether they could actually be parsed).\n\nPlugins are found non-recursively and paths beginning with a dot are always ignored.\n\n## Types\n\n```go\ntype APIProviderFunc func(*model.Manifest) (plugin.API, error)\n```\n\n```go\ntype ActivePlugin struct {\n\tBundleInfo *model.BundleInfo\n\tSupervisor plugin.Supervisor\n}\n```\n\n```go\ntype Environment struct {\n\t// contains filtered or unexported fields\n}\n```\nEnvironment represents an environment that plugins are discovered and launched in.\n\n```go\nfunc New(options ...Option) (*Environment, error)\n```\nCreates a new environment. At a minimum, the APIProvider and SearchPath options are required.\n\n```go\nfunc (env *Environment) ActivatePlugin(id string) error\n```\nActivates the plugin with the given id.\n\n```go\nfunc (env *Environment) ActivePluginIds() (ids []string)\n```\nReturns the ids of the currently active plugins.\n\n```go\nfunc (env *Environment) ActivePlugins() []*model.BundleInfo\n```\nReturns a list of all currently active plugins within the environment.\n\n```go\nfunc (env *Environment) DeactivatePlugin(id string) error\n```\nDeactivates the plugin with the given id.\n\n```go\nfunc (env *Environment) Hooks() *MultiPluginHooks\n```\n\n```go\nfunc (env *Environment) HooksForPlugin(id string) *SinglePluginHooks\n```\n\n```go\nfunc (env *Environment) IsPluginActive(pluginId string) bool\n```\nReturns true if the plugin is active, false otherwise.\n\n```go\nfunc (env *Environment) Plugins() ([]*model.BundleInfo, error)\n```\nReturns a list of all plugins found within the environment.\n\n```go\nfunc (env *Environment) SearchPath() string\n```\nReturns the configured search path.\n\n```go\nfunc (env *Environment) Shutdown() (errs []error)\n```\nDeactivates all plugins and gracefully shuts down the environment.\n\n```go\nfunc (env *Environment) WebappPath() string\n```\nReturns the configured webapp path.\n\n```go\ntype MultiPluginHooks struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (h *MultiPluginHooks) OnConfigurationChange() []error\n```\nOnConfigurationChange invokes the OnConfigurationChange hook for all plugins. Any errors encountered will be returned.\n\n```go\nfunc (h *MultiPluginHooks) ServeHTTP(w http.ResponseWriter, r *http.Request)\n```\nServeHTTP invokes the ServeHTTP hook for the plugin identified by the request or responds with a 404 not found.\n\nIt expects the request's context to have a plugin\\_id set.\n\n```go\ntype Option func(*Environment)\n```\n\n```go\nfunc APIProvider(provider APIProviderFunc) Option\n```\nAPIProvider specifies a function that provides an API implementation to each plugin.\n\n```go\nfunc SearchPath(path string) Option\n```\nSearchPath specifies a directory that contains the plugins to launch.\n\n```go\nfunc SupervisorProvider(provider SupervisorProviderFunc) Option\n```\nSupervisorProvider specifies a function that provides a Supervisor implementation to each plugin. If unspecified, DefaultSupervisorProvider is used.\n\n```go\nfunc WebappPath(path string) Option\n```\nWebappPath specifies the static directory serving the webapp.\n\n```go\ntype SinglePluginHooks struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (h *SinglePluginHooks) ExecuteCommand(args *model.CommandArgs) (resp *model.CommandResponse, appErr *model.AppError, err error)\n```\nExecuteCommand invokes the ExecuteCommand hook for the plugin.\n\n```go\ntype SupervisorProviderFunc func(*model.BundleInfo) (plugin.Supervisor, error)\n```\n\n","path":"github.com/Mattermost/platform/plugin/pluginenv","name":"pluginenv","synopsis":"Package pluginenv provides high level functionality for discovering and launching plugins.","isRedistributable":true}
