diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-09-01 09:00:27 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-01 09:00:27 -0400 |
commit | 899ab31fff9b34bc125faf75b79a89e390deb2cf (patch) | |
tree | 41dc5832268504e54a0b2188eedcf89b7828dd12 /plugin/pluginenv/options.go | |
parent | 74b5e52c4eb54000dcb5a7b46c0977d732bce80f (diff) | |
download | chat-899ab31fff9b34bc125faf75b79a89e390deb2cf.tar.gz chat-899ab31fff9b34bc125faf75b79a89e390deb2cf.tar.bz2 chat-899ab31fff9b34bc125faf75b79a89e390deb2cf.zip |
Implement experimental REST API endpoints for plugins (#7279)
* Implement experimental REST API endpoints for plugins
* Updates per feedback and rebase
* Update tests
* Further updates
* Update extraction of plugins
* Use OS temp dir for plugins instead of search path
* Fail extraction on paths that attempt to traverse upward
* Update pluginenv ActivePlugins()
Diffstat (limited to 'plugin/pluginenv/options.go')
-rw-r--r-- | plugin/pluginenv/options.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/plugin/pluginenv/options.go b/plugin/pluginenv/options.go index 3f83228fb..e5ef9678d 100644 --- a/plugin/pluginenv/options.go +++ b/plugin/pluginenv/options.go @@ -3,6 +3,7 @@ package pluginenv import ( "fmt" + "github.com/mattermost/platform/model" "github.com/mattermost/platform/plugin" "github.com/mattermost/platform/plugin/rpcplugin" ) @@ -29,14 +30,21 @@ func SearchPath(path string) Option { } } +// WebappPath specifies the static directory serving the webapp. +func WebappPath(path string) Option { + return func(env *Environment) { + env.webappPath = path + } +} + // DefaultSupervisorProvider chooses a supervisor based on the plugin's manifest contents. E.g. if // the manifest specifies a backend executable, it will be given an rpcplugin.Supervisor. -func DefaultSupervisorProvider(bundle *plugin.BundleInfo) (plugin.Supervisor, error) { +func DefaultSupervisorProvider(bundle *model.BundleInfo) (plugin.Supervisor, error) { if bundle.Manifest == nil { return nil, fmt.Errorf("a manifest is required") } if bundle.Manifest.Backend == nil { - return nil, fmt.Errorf("invalid manifest: at this time, only backend plugins are supported") + return nil, fmt.Errorf("invalid manifest: missing backend plugin") } return rpcplugin.SupervisorProvider(bundle) } |