summaryrefslogtreecommitdiffstats
path: root/mattermost.go
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2015-12-01 08:33:23 -0800
committerCorey Hulen <corey@hulen.com>2015-12-01 08:33:23 -0800
commite460bc2665ea3af927055f30727cb97952e64313 (patch)
treec3e98a2ca7c5d8ebf2ac298ef846734c1dc29a45 /mattermost.go
parent62c96514bfa243029dba2d9b47b5b8a8322059e4 (diff)
parentf5907e21cad055b241718d2bd1530bd4c22e77c7 (diff)
downloadchat-e460bc2665ea3af927055f30727cb97952e64313.tar.gz
chat-e460bc2665ea3af927055f30727cb97952e64313.tar.bz2
chat-e460bc2665ea3af927055f30727cb97952e64313.zip
Merge pull request #1555 from mattermost/PLT-902
PLT-902 switching to push proxy server
Diffstat (limited to 'mattermost.go')
-rw-r--r--mattermost.go26
1 files changed, 18 insertions, 8 deletions
diff --git a/mattermost.go b/mattermost.go
index 2d5727400..eaab1de88 100644
--- a/mattermost.go
+++ b/mattermost.go
@@ -68,6 +68,7 @@ func main() {
manualtesting.InitManualTesting()
}
+ setDiagnosticId()
runSecurityAndDiagnosticsJobAndForget()
// wait for kill signal before attempting to gracefully shutdown
@@ -80,6 +81,21 @@ func main() {
}
}
+func setDiagnosticId() {
+ if result := <-api.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)
+ }
+
+ utils.CfgDiagnosticId = id
+ }
+}
+
func runSecurityAndDiagnosticsJobAndForget() {
go func() {
for {
@@ -92,15 +108,9 @@ func runSecurityAndDiagnosticsJobAndForget() {
if (currentTime - lastSecurityTime) > 1000*60*60*24*1 {
l4g.Debug("Checking for security update from Mattermost")
- 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)
- }
-
v := url.Values{}
- v.Set(utils.PROP_DIAGNOSTIC_ID, id)
+
+ v.Set(utils.PROP_DIAGNOSTIC_ID, utils.CfgDiagnosticId)
v.Set(utils.PROP_DIAGNOSTIC_BUILD, model.CurrentVersion+"."+model.BuildNumber)
v.Set(utils.PROP_DIAGNOSTIC_DATABASE, utils.Cfg.SqlSettings.DriverName)
v.Set(utils.PROP_DIAGNOSTIC_OS, runtime.GOOS)