From dd35ad43caab407cc70ef3b153b3f94d57242ed9 Mon Sep 17 00:00:00 2001 From: Jesse Hallam Date: Thu, 21 Jun 2018 14:31:51 -0400 Subject: MM-10370: serve subpath (#8968) * factor out GetSubpathFromConfig * mv web/subpath.go to utils/subpath.go * serve up web, api and ws on /subpath if configured * pass config to utils.RenderWeb(App)?Error This allows the methods to extract the configured subpath and redirect to the appropriate `/subpath/error` handler. * ensure GetSubpathFromConfig returns trailing slashes deterministically * fix error 404 handling * redirect /subpath to /subpath/ This is necessary for the static handler to match, otherwise none of the registered routes find anything. This also makes it no longer necessary to add trailing slashes in the root router. --- cmd/mattermost/commands/config.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'cmd') diff --git a/cmd/mattermost/commands/config.go b/cmd/mattermost/commands/config.go index 0b0e00f35..d9881b050 100644 --- a/cmd/mattermost/commands/config.go +++ b/cmd/mattermost/commands/config.go @@ -12,7 +12,6 @@ import ( "github.com/mattermost/mattermost-server/model" "github.com/mattermost/mattermost-server/utils" - "github.com/mattermost/mattermost-server/web" ) var ConfigCmd = &cobra.Command{ @@ -92,8 +91,8 @@ func configSubpathCmdF(command *cobra.Command, args []string) error { if err != nil { return errors.Wrap(err, "failed reading path") } else if path == "" { - return web.UpdateAssetsSubpathFromConfig(a.Config()) - } else if err := web.UpdateAssetsSubpath(path); err != nil { + return utils.UpdateAssetsSubpathFromConfig(a.Config()) + } else if err := utils.UpdateAssetsSubpath(path); err != nil { return errors.Wrap(err, "failed to update assets subpath") } -- cgit v1.2.3-1-g7c22