summaryrefslogtreecommitdiffstats
path: root/app/app.go
diff options
context:
space:
mode:
authorJesús Espino <jespinog@gmail.com>2018-08-08 12:04:36 +0200
committerCarlos Tadeu Panato Junior <ctadeu@gmail.com>2018-08-08 12:04:36 +0200
commit6bf09e2c34c568e3cb0d296142d5abed77332635 (patch)
treea8a05b94c842d53dede08fe8d52ad28cf2c89a73 /app/app.go
parent3b640cd51b5b622002d6c9a0d6b1e7a6e9dafb69 (diff)
downloadchat-6bf09e2c34c568e3cb0d296142d5abed77332635.tar.gz
chat-6bf09e2c34c568e3cb0d296142d5abed77332635.tar.bz2
chat-6bf09e2c34c568e3cb0d296142d5abed77332635.zip
MM-11384: Add system install date information to the client config (#9218)
* MM-11384: Add system install date information to the client config * Fixing translation text * Fixes from Peer Review
Diffstat (limited to 'app/app.go')
-rw-r--r--app/app.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/app.go b/app/app.go
index 5cedca2ad..b704bb449 100644
--- a/app/app.go
+++ b/app/app.go
@@ -11,6 +11,7 @@ import (
"net/http"
"path"
"reflect"
+ "strconv"
"strings"
"sync"
"sync/atomic"
@@ -212,6 +213,10 @@ func New(options ...Option) (outApp *App, outErr error) {
return nil, errors.Wrapf(err, "unable to ensure asymmetric signing key")
}
+ if err := app.ensureInstallationDate(); err != nil {
+ return nil, errors.Wrapf(err, "unable to ensure installation date")
+ }
+
app.EnsureDiagnosticId()
app.regenerateClientConfig()
@@ -740,3 +745,16 @@ func (a *App) StartElasticsearch() {
}
})
}
+
+func (a *App) getSystemInstallDate() (int64, *model.AppError) {
+ result := <-a.Srv.Store.System().GetByName(model.SYSTEM_INSTALLATION_DATE_KEY)
+ if result.Err != nil {
+ return 0, result.Err
+ }
+ systemData := result.Data.(*model.System)
+ value, err := strconv.ParseInt(systemData.Value, 10, 64)
+ if err != nil {
+ return 0, model.NewAppError("getSystemInstallDate", "app.system_install_date.parse_int.app_error", nil, err.Error(), http.StatusInternalServerError)
+ }
+ return value, nil
+}