diff options
author | =Corey Hulen <corey@hulen.com> | 2015-11-30 22:38:38 -0800 |
---|---|---|
committer | =Corey Hulen <corey@hulen.com> | 2015-11-30 22:38:38 -0800 |
commit | 68765a8f21db8a1b732f26f5bc1bf0e1a8e52d8f (patch) | |
tree | bc3d4e1f75398a84cc3be049b23cd29466e780a4 /mattermost.go | |
parent | b717a8100c3f2049fb94040ad8db11f56c0d9f13 (diff) | |
download | chat-68765a8f21db8a1b732f26f5bc1bf0e1a8e52d8f.tar.gz chat-68765a8f21db8a1b732f26f5bc1bf0e1a8e52d8f.tar.bz2 chat-68765a8f21db8a1b732f26f5bc1bf0e1a8e52d8f.zip |
PLT-902 switching to push proxy server
Diffstat (limited to 'mattermost.go')
-rw-r--r-- | mattermost.go | 26 |
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) |