From 402491b7e52c4d836c1274976cdb387852cfd17b Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 11 Sep 2017 10:02:02 -0500 Subject: PLT-7407: Back-end plugins (#7409) * tie back-end plugins together * fix comment typo * add tests and a bit of polish * tests and polish * add test, don't let backend executable paths escape the plugin directory --- app/server.go | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) (limited to 'app/server.go') diff --git a/app/server.go b/app/server.go index 21d727724..c44408d12 100644 --- a/app/server.go +++ b/app/server.go @@ -7,7 +7,6 @@ import ( "crypto/tls" "net" "net/http" - "os" "strings" "time" @@ -20,7 +19,6 @@ import ( "gopkg.in/throttled/throttled.v2/store/memstore" "github.com/mattermost/mattermost-server/model" - "github.com/mattermost/mattermost-server/plugin/pluginenv" "github.com/mattermost/mattermost-server/store" "github.com/mattermost/mattermost-server/utils" ) @@ -30,7 +28,6 @@ type Server struct { WebSocketRouter *WebSocketRouter Router *mux.Router GracefulServer *graceful.Server - PluginEnv *pluginenv.Environment } var allowedMethods []string = []string{ @@ -187,10 +184,6 @@ func (a *App) StartServer() { }() } - if utils.IsLicensed() && *utils.License().Features.FutureFeatures && *utils.Cfg.PluginSettings.Enable { - a.StartupPlugins("plugins", "webapp/dist") - } - go func() { var err error if *utils.Cfg.ServiceSettings.ConnectionSecurity == model.CONN_SECURITY_TLS { @@ -226,30 +219,7 @@ func (a *App) StopServer() { a.Srv.Store.Close() HubStop() - l4g.Info(utils.T("api.server.stop_server.stopped.info")) -} - -func (a *App) StartupPlugins(pluginPath, webappPath string) { - l4g.Info("Starting up plugins") - - err := os.Mkdir(pluginPath, 0744) - if err != nil { - if os.IsExist(err) { - err = nil - } else { - l4g.Error("failed to start up plugins: " + err.Error()) - return - } - } - - a.Srv.PluginEnv, err = pluginenv.New( - pluginenv.SearchPath(pluginPath), - pluginenv.WebappPath(webappPath), - ) + a.ShutDownPlugins() - if err != nil { - l4g.Error("failed to start up plugins: " + err.Error()) - } - - a.ActivatePlugins() + l4g.Info(utils.T("api.server.stop_server.stopped.info")) } -- cgit v1.2.3-1-g7c22