summaryrefslogtreecommitdiffstats
path: root/cmd/platform/server.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/platform/server.go')
-rw-r--r--cmd/platform/server.go37
1 files changed, 19 insertions, 18 deletions
diff --git a/cmd/platform/server.go b/cmd/platform/server.go
index 51078b6aa..5abc4d6e8 100644
--- a/cmd/platform/server.go
+++ b/cmd/platform/server.go
@@ -16,6 +16,7 @@ import (
l4g "github.com/alecthomas/log4go"
"github.com/mattermost/platform/api"
+ "github.com/mattermost/platform/app"
"github.com/mattermost/platform/einterfaces"
"github.com/mattermost/platform/manualtesting"
"github.com/mattermost/platform/model"
@@ -63,8 +64,8 @@ func runServer(configFileLocation string) {
cmdUpdateDb30()
- api.NewServer()
- api.InitStores()
+ app.NewServer()
+ app.InitStores()
api.InitRouter()
api.InitApi()
web.InitWeb()
@@ -84,7 +85,7 @@ func runServer(configFileLocation string) {
resetStatuses()
- api.StartServer()
+ app.StartServer()
// If we allow testing then listen for manual testing URL hits
if utils.Cfg.ServiceSettings.EnableTesting {
@@ -120,7 +121,7 @@ func runServer(configFileLocation string) {
einterfaces.GetMetricsInterface().StopServer()
}
- api.StopServer()
+ app.StopServer()
}
func runSecurityAndDiagnosticsJob() {
@@ -129,20 +130,20 @@ func runSecurityAndDiagnosticsJob() {
}
func resetStatuses() {
- if result := <-api.Srv.Store.Status().ResetAll(); result.Err != nil {
+ if result := <-app.Srv.Store.Status().ResetAll(); result.Err != nil {
l4g.Error(utils.T("mattermost.reset_status.error"), result.Err.Error())
}
}
func setDiagnosticId() {
- if result := <-api.Srv.Store.System().Get(); result.Err == nil {
+ if result := <-app.Srv.Store.System().Get(); result.Err == nil {
props := result.Data.(model.StringMap)
id := props[model.SYSTEM_DIAGNOSTIC_ID]
if len(id) == 0 {
id = model.NewId()
systemId := &model.System{Name: model.SYSTEM_DIAGNOSTIC_ID, Value: id}
- <-api.Srv.Store.System().Save(systemId)
+ <-app.Srv.Store.System().Save(systemId)
}
utils.CfgDiagnosticId = id
@@ -151,7 +152,7 @@ func setDiagnosticId() {
func doSecurityAndDiagnostics() {
if *utils.Cfg.ServiceSettings.EnableSecurityFixAlert {
- if result := <-api.Srv.Store.System().Get(); result.Err == nil {
+ if result := <-app.Srv.Store.System().Get(); result.Err == nil {
props := result.Data.(model.StringMap)
lastSecurityTime, _ := strconv.ParseInt(props[model.SYSTEM_LAST_SECURITY_TIME], 10, 0)
currentTime := model.GetMillis()
@@ -176,20 +177,20 @@ func doSecurityAndDiagnostics() {
systemSecurityLastTime := &model.System{Name: model.SYSTEM_LAST_SECURITY_TIME, Value: strconv.FormatInt(currentTime, 10)}
if lastSecurityTime == 0 {
- <-api.Srv.Store.System().Save(systemSecurityLastTime)
+ <-app.Srv.Store.System().Save(systemSecurityLastTime)
} else {
- <-api.Srv.Store.System().Update(systemSecurityLastTime)
+ <-app.Srv.Store.System().Update(systemSecurityLastTime)
}
- if ucr := <-api.Srv.Store.User().GetTotalUsersCount(); ucr.Err == nil {
+ if ucr := <-app.Srv.Store.User().GetTotalUsersCount(); ucr.Err == nil {
v.Set(utils.PROP_DIAGNOSTIC_USER_COUNT, strconv.FormatInt(ucr.Data.(int64), 10))
}
- if ucr := <-api.Srv.Store.Status().GetTotalActiveUsersCount(); ucr.Err == nil {
+ if ucr := <-app.Srv.Store.Status().GetTotalActiveUsersCount(); ucr.Err == nil {
v.Set(utils.PROP_DIAGNOSTIC_ACTIVE_USER_COUNT, strconv.FormatInt(ucr.Data.(int64), 10))
}
- if tcr := <-api.Srv.Store.Team().AnalyticsTeamCount(); tcr.Err == nil {
+ if tcr := <-app.Srv.Store.Team().AnalyticsTeamCount(); tcr.Err == nil {
v.Set(utils.PROP_DIAGNOSTIC_TEAM_COUNT, strconv.FormatInt(tcr.Data.(int64), 10))
}
@@ -206,7 +207,7 @@ func doSecurityAndDiagnostics() {
for _, bulletin := range bulletins {
if bulletin.AppliesToVersion == model.CurrentVersion {
if props["SecurityBulletin_"+bulletin.Id] == "" {
- if results := <-api.Srv.Store.User().GetSystemAdminProfiles(); results.Err != nil {
+ if results := <-app.Srv.Store.User().GetSystemAdminProfiles(); results.Err != nil {
l4g.Error(utils.T("mattermost.system_admins.error"))
return
} else {
@@ -232,7 +233,7 @@ func doSecurityAndDiagnostics() {
}
bulletinSeen := &model.System{Name: "SecurityBulletin_" + bulletin.Id, Value: bulletin.Id}
- <-api.Srv.Store.System().Save(bulletinSeen)
+ <-app.Srv.Store.System().Save(bulletinSeen)
}
}
}
@@ -251,15 +252,15 @@ func sendServerDiagnostics() {
var activeUserCount int64
var teamCount int64
- if ucr := <-api.Srv.Store.User().GetTotalUsersCount(); ucr.Err == nil {
+ if ucr := <-app.Srv.Store.User().GetTotalUsersCount(); ucr.Err == nil {
userCount = ucr.Data.(int64)
}
- if ucr := <-api.Srv.Store.Status().GetTotalActiveUsersCount(); ucr.Err == nil {
+ if ucr := <-app.Srv.Store.Status().GetTotalActiveUsersCount(); ucr.Err == nil {
activeUserCount = ucr.Data.(int64)
}
- if tcr := <-api.Srv.Store.Team().AnalyticsTeamCount(); tcr.Err == nil {
+ if tcr := <-app.Srv.Store.Team().AnalyticsTeamCount(); tcr.Err == nil {
teamCount = tcr.Data.(int64)
}