summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2018-05-30 06:58:24 -0700
committerJoram Wilander <jwawilander@gmail.com>2018-05-30 09:58:24 -0400
commitaf4e907f5e21d85622d4d7c08a7f29c3d4c46039 (patch)
treecdf2dd1c59d744b5c81d543c9e97cb74b2d3d28a /cmd
parent2f6039f23f75ef0d63f980c8354d3d638071f230 (diff)
downloadchat-af4e907f5e21d85622d4d7c08a7f29c3d4c46039.tar.gz
chat-af4e907f5e21d85622d4d7c08a7f29c3d4c46039.tar.bz2
chat-af4e907f5e21d85622d4d7c08a7f29c3d4c46039.zip
MM-10731 Revert site url kill server (#8877)
* Revert "MM-9983 Requiring SiteURL to be set. (#8769)" This reverts commit 0432f995ec27de9ee6cc2f5847d4a17fcc095a26. * Add log message for SiteURL not being set.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/mattermost/commands/server.go20
-rw-r--r--cmd/mattermost/commands/server_test.go10
2 files changed, 7 insertions, 23 deletions
diff --git a/cmd/mattermost/commands/server.go b/cmd/mattermost/commands/server.go
index 299005b6a..20ebfade6 100644
--- a/cmd/mattermost/commands/server.go
+++ b/cmd/mattermost/commands/server.go
@@ -6,7 +6,6 @@ package commands
import (
"fmt"
"net"
- "net/http"
"net/url"
"os"
"os/signal"
@@ -74,6 +73,11 @@ func runServer(configFileLocation string, disableConfigWatch bool, usedPlatform
if usedPlatform {
mlog.Error("The platform binary has been deprecated, please switch to using the mattermost binary.")
}
+
+ if _, err := url.ParseRequestURI(*a.Config().ServiceSettings.SiteURL); err != nil {
+ mlog.Error("SiteURL must be set. Some features will operate incorrectly if the SiteURL is not set. See documentation for details: http://about.mattermost.com/default-site-url")
+ }
+
mlog.Info(fmt.Sprintf("Current version is %v (%v/%v/%v/%v)", model.CurrentVersion, model.BuildNumber, model.BuildDate, model.BuildHash, model.BuildHashEnterprise))
mlog.Info(fmt.Sprintf("Enterprise Enabled: %v", model.BuildEnterpriseReady))
mlog.Info(fmt.Sprintf("Current working directory is %v", pwd))
@@ -131,19 +135,7 @@ func runServer(configFileLocation string, disableConfigWatch bool, usedPlatform
// Enable developer settings if this is a "dev" build
if model.BuildNumber == "dev" {
- a.UpdateConfig(func(cfg *model.Config) {
- *cfg.ServiceSettings.EnableDeveloper = true
- if *cfg.ServiceSettings.SiteURL == "" {
- *cfg.ServiceSettings.SiteURL = "http://localhost:8065"
- }
- })
- }
-
- // SiteURL should be set at this point. Either by a user or by the dev mode above
- // This is here instead of in config.IsValid because there are many tests that make the assumption
- // that the default config is valid. Which it is not.
- if _, err := url.ParseRequestURI(*a.Config().ServiceSettings.SiteURL); err != nil {
- return model.NewAppError("Config.IsValid", "model.config.is_valid.site_url.app_error", nil, "", http.StatusBadRequest)
+ a.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableDeveloper = true })
}
resetStatuses(a)
diff --git a/cmd/mattermost/commands/server_test.go b/cmd/mattermost/commands/server_test.go
index a0c7c6948..0f825e316 100644
--- a/cmd/mattermost/commands/server_test.go
+++ b/cmd/mattermost/commands/server_test.go
@@ -11,7 +11,6 @@ import (
"testing"
"github.com/mattermost/mattermost-server/jobs"
- "github.com/mattermost/mattermost-server/model"
"github.com/mattermost/mattermost-server/utils"
"github.com/stretchr/testify/require"
)
@@ -21,7 +20,6 @@ type ServerTestHelper struct {
disableConfigWatch bool
interruptChan chan os.Signal
originalInterval int
- oldBuildNumber string
}
func SetupServerTest() *ServerTestHelper {
@@ -43,20 +41,14 @@ func SetupServerTest() *ServerTestHelper {
interruptChan: interruptChan,
originalInterval: originalInterval,
}
-
- // Run in dev mode so SiteURL gets set
- th.oldBuildNumber = model.BuildNumber
- model.BuildNumber = "dev"
-
return th
}
func (th *ServerTestHelper) TearDownServerTest() {
jobs.DEFAULT_WATCHER_POLLING_INTERVAL = th.originalInterval
- model.BuildNumber = th.oldBuildNumber
}
-func TestRunServerSiteURL(t *testing.T) {
+func TestRunServerSuccess(t *testing.T) {
th := SetupServerTest()
defer th.TearDownServerTest()