diff options
author | Martin Kraft <martinkraft@gmail.com> | 2018-05-22 12:54:00 -0400 |
---|---|---|
committer | Martin Kraft <martinkraft@gmail.com> | 2018-05-22 12:54:00 -0400 |
commit | 4c683aff7627040ff811f065848a820b2cb19d59 (patch) | |
tree | 668061e8acfd8827fd02bab18a998b7986944296 /cmd/mattermost/commands/server.go | |
parent | eb78d273f39202046fa71555a5a19b0ec8a95cb3 (diff) | |
parent | 1af1bce6199597bb2d41ddcdc00ef0f28a73c83e (diff) | |
download | chat-4c683aff7627040ff811f065848a820b2cb19d59.tar.gz chat-4c683aff7627040ff811f065848a820b2cb19d59.tar.bz2 chat-4c683aff7627040ff811f065848a820b2cb19d59.zip |
Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-2
Diffstat (limited to 'cmd/mattermost/commands/server.go')
-rw-r--r-- | cmd/mattermost/commands/server.go | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/cmd/mattermost/commands/server.go b/cmd/mattermost/commands/server.go index 9d0e5a917..299005b6a 100644 --- a/cmd/mattermost/commands/server.go +++ b/cmd/mattermost/commands/server.go @@ -6,6 +6,8 @@ package commands import ( "fmt" "net" + "net/http" + "net/url" "os" "os/signal" "syscall" @@ -129,7 +131,19 @@ 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 }) + 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) } resetStatuses(a) |