func webClientTestsCmdF(cmd *cobra.Command, args []string) error { initDBCommandContextCobra(cmd) utils.InitTranslations(utils.Cfg.LocalizationSettings) api.InitRouter() api.InitApi() setupClientTests() app.StartServer() runWebClientTests() app.StopServer() return nil }
func doLegacyCommands() { doLoadConfig(flagConfigFile) utils.InitTranslations(utils.Cfg.LocalizationSettings) utils.ConfigureCmdLineLog() app.NewServer() app.InitStores() api.InitRouter() api.InitApi() web.InitWeb() if model.BuildEnterpriseReady == "true" { api.LoadLicense() } runCmds() }
func Setup() { if api.Srv == nil { utils.TranslationsPreInit() utils.LoadConfig("config.json") utils.InitTranslations(utils.Cfg.LocalizationSettings) api.NewServer() api.InitStores() api.InitRouter() api.StartServer() api.InitApi() InitWeb() URL = "http://localhost" + utils.Cfg.ServiceSettings.ListenAddress ApiClient = model.NewClient(URL) api.Srv.Store.MarkSystemRanUnitTests() *utils.Cfg.TeamSettings.EnableOpenServer = true } }
func runServer(configFileLocation string) { if errstr := doLoadConfig(configFileLocation); errstr != "" { l4g.Exit("Unable to load mattermost configuration file: ", errstr) return } utils.InitTranslations(utils.Cfg.LocalizationSettings) utils.TestConnection(utils.Cfg) pwd, _ := os.Getwd() l4g.Info(utils.T("mattermost.current_version"), model.CurrentVersion, model.BuildNumber, model.BuildDate, model.BuildHash, model.BuildHashEnterprise) l4g.Info(utils.T("mattermost.entreprise_enabled"), model.BuildEnterpriseReady) l4g.Info(utils.T("mattermost.working_dir"), pwd) l4g.Info(utils.T("mattermost.config_file"), utils.FindConfigFile(configFileLocation)) // Enable developer settings if this is a "dev" build if model.BuildNumber == "dev" { *utils.Cfg.ServiceSettings.EnableDeveloper = true } cmdUpdateDb30() app.NewServer() app.InitStores() api.InitRouter() api.InitApi() web.InitWeb() if model.BuildEnterpriseReady == "true" { api.LoadLicense() } if !utils.IsLicensed && len(utils.Cfg.SqlSettings.DataSourceReplicas) > 1 { l4g.Warn(utils.T("store.sql.read_replicas_not_licensed.critical")) utils.Cfg.SqlSettings.DataSourceReplicas = utils.Cfg.SqlSettings.DataSourceReplicas[:1] } if !utils.IsLicensed { utils.Cfg.TeamSettings.MaxNotificationsPerChannel = &MaxNotificationsPerChannelDefault } resetStatuses() app.StartServer() // If we allow testing then listen for manual testing URL hits if utils.Cfg.ServiceSettings.EnableTesting { manualtesting.InitManualTesting() } setDiagnosticId() go runSecurityAndDiagnosticsJob() if complianceI := einterfaces.GetComplianceInterface(); complianceI != nil { complianceI.StartComplianceDailyJob() } if einterfaces.GetClusterInterface() != nil { einterfaces.GetClusterInterface().StartInterNodeCommunication() } if einterfaces.GetMetricsInterface() != nil { einterfaces.GetMetricsInterface().StartServer() } // wait for kill signal before attempting to gracefully shutdown // the running service c := make(chan os.Signal) signal.Notify(c, os.Interrupt, syscall.SIGINT, syscall.SIGTERM) <-c if einterfaces.GetClusterInterface() != nil { einterfaces.GetClusterInterface().StopInterNodeCommunication() } if einterfaces.GetMetricsInterface() != nil { einterfaces.GetMetricsInterface().StopServer() } app.StopServer() }